javascript - Very simple jQuery not working -
simply put, jquery not working.
here code:
<!doctype html> <html> <head> <title>jquery 101</title> </head> <body> <div> <h1>hello, world!</h1> <p>test</p> </div> <script src="/scripts/jquery/jquery-1.9.1.min.js"></script> <script> alert('hello world'); $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </body> </html> the included jquery file in filesystem , alert() function working, simple jquery example not working. may rookie error, i'm not sure why.
- using
jboss 7.1.1.finaldeployment - using
google chromeviewing
edit: managed fixed original issue: due fact not referencing scripts correctly. 'scripts' folder located @ root of webapp, when changed reference this:
<script src="../scripts/jquery/jquery-1.9.1.min.js"></script> (note 2 preceeding dots) seemed work fine!
or can use online script source :
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> works fine
Comments
Post a Comment