html - Jquery doesn't link, why? -
<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <script type="text/javascript" src="script.js"></script> </head> <body> <div id="red"></div> <div id="blue"></div> <div id="yellow"></div> <div id="green"></div> </body> </html>
script.js
$(document).ready(function() { $('div').mouseenter(function() { $(this).animate({ height: '+=10px' }); }); $('div').mouseleave(function() { $(this).animate({ height: '-=10px' }); }); $('div').click(function() { $(this).toggle(1000); }); });
add jquery framework html head tag, before own js use jquery:
<head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script type="text/javascript" src="script.js"></script> </head>
Comments
Post a Comment