button - Making JQuery work (linking the .js to the .html) -
i struggling basic of jquery magic: making work. had bigger jquery file (previously) functional javascript, problem persisted when boiled down page button once clicked supposed fade out. can suppose referencing wrongly.
this html
<!doctype html> <html> <head> <script type="text/javascript" src="script.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> </head> <body> <button>make me vanish!</button> </body> </html>
and here script.js
$(document).ready(){ $('button').onclick(function(){ $('button').fadeout('fast'); });});
this link test-page itself(not working): http://folk.ntnu.no/benjamas/test.html
you'll need load jquery before scripts uses jquery :
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> <script type="text/javascript" src="script.js"></script>
and know you're including jquery ui, , not library ?
and js should :
$(function(){ $('button').on('click', function(){ $(this).fadeout('fast'); }); });
Comments
Post a Comment