Javascript works but jQuery doesn't and I have loaded the libraries -


for reason jquery functions not being called. if window.alert out of jquery function, works. don't know doing wrong.

<!doctype html> <html>   <head>     <title>bubble sort</title>     <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />     <script type="text/javascript" src="script.js"></script>     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>     <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>   </head>   <body>     <h1>bubble sort</h1>     <h2>author: hugo l. villalobos</h2>     <div></div>   </body> </html> 
$(document).ready(function() {   window.alert("hello wold"); }) 

as @rory mccrossan said, script.js (or includes jquery code) should included after jquery link. change code to:

<!doctype html>  <html>    <head>      <title>bubble sort</title>      <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>      <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>      <script type="text/javascript" src="script.js"></script>    </head>    <body>      <h1>bubble sort</h1>      <h2>author: hugo l. villalobos</h2>      <div></div>    </body>  </html>

this should make right rain. put script.js after jquery api link.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -