Skip to content Skip to sidebar Skip to footer

Why My Jquery Code Can Run On Jsfiddle But Not On Dreamweaver Or Browser?

My jQuery code can run on jsfiddle but not on Dreamweaver nor browser? Here is the link to my code on JSfiddle, and below is my codes. please help me check if there is something mi

Solution 1:

There are three things need to be pay attention:

  1. Must load jQuery on your page. Like this: <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>

  2. the jQuery lib position must load before your script.

  3. your code must be wrapped used $(function (){}), or your code load after the DOM loaded.

Solution 2:

You do not have the JQuery framework (dependency) linked in the head before your own script:

http://puu.sh/bDukO.PNG

add this line to your html code directly underneath the head tag and before your own script:

<scriptsrc="https://code.jquery.com/jquery-2.1.1.min.js"></script>

Note You dont need the 'type' attribute in script tags in HTML5 anymore

Solution 3:

You have an open tag in your example code.

Your example code (just line 21):

<h1>Basket:</h1

Should be

<h1>Basket:</h1>

It appears closed in your JSFiddle example. Hope that helps.

Post a Comment for "Why My Jquery Code Can Run On Jsfiddle But Not On Dreamweaver Or Browser?"