www.webdeveloper.com
Results 1 to 5 of 5

Thread: jQuery doing nothing...

  1. #1
    Join Date
    Jan 2014
    Posts
    3

    jQuery doing nothing...

    Hi. I'm using Aptana Studio 3 to work on a project. The problem is that I can't seem to get jQuery to do anything. There is no error or anything...just nothing happens.

    Here is what I have in the html file:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>New Web Project</title>
    <link rel="stylesheet" href="Styles.css" />
    <script src="jquery.js" type="text/javascript"></script>
    </head>

    <body>
    <h1 align="center">New Web Project Page</h1>
    <p>Hide me please...</p>
    </body>

    </html>


    This is the jquery.js file:

    $(document).ready(function(){
    $("p").click(function(){
    this.hide();
    });
    });


    I run it with Aptana studio then try to click the text "Hide me please..." and nothing happens (it is supposed to be hidden after being clicked.

    Help?

  2. #2
    Join Date
    Oct 2013
    Posts
    472
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>New Web Project</title>
    <link rel="stylesheet" href="Styles.css" />
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    <script src="jquery.js" type="text/javascript"></script>
    </head>
    
    <body>
    <h1 align="center">New Web Project Page</h1>
    <p>Hide me please...</p>
    
    </body>
    
    </html>
    Code:
    $(document).ready(function(){
    $("p").click(function(){
    this.style.display='none';
    });
    });
    I'll leave it to you to discover why I changed and added what I did. Hint: Shift-Ctrl-J in Chrome.
    Last edited by Kevin2; 01-16-2014 at 10:34 AM.

  3. #3
    Join Date
    Jan 2014
    Posts
    3
    Thank you for your help. The tutorial I was reading never mentioned anything about having this:

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>

  4. #4
    Join Date
    Jan 2014
    Posts
    3
    Thank you for your help!

  5. #5
    Join Date
    Oct 2013
    Posts
    472
    You're welcome!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles