-1

JSFiddle demo: https://jsfiddle.net/cr33q8v7/

$("#findMyWeather").click(function() {
    alert("button clicked");
});

All I'm trying to verify is if the JQuery is working and I'm not getting any pop-up that says button clicked, so it would appear the syntax is wrong, but I've checked it multiple times and it looks right.

So if I include the library on JSFiddle, then why does the below code in the HTML file not run, as it appears the function is identical and these pointers both direct to the library:

    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
    <script>
        $("#findMyWeather").click(function() {
            alert("button clicked");
        });
    </script>

So the // pointers didn't reference (this is what the teacher instructed). When I changed to `https:``, then it functioned correctly:

    <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
    <script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

I need another set of eyes, or else I'm missing something else and just don't see it.

2
  • Click in the JavaScript gear and select a jQuery version to include in your fiddle.
    – yuriy636
    Aug 27, 2016 at 10:59
  • You have not added script library in the program
    – Roma
    Aug 27, 2016 at 11:00

6 Answers 6

5

You need to include the jQuery library in JSFiddle. Click the gear that says Javascript and choose the version of jQuery that suits you.

1

Your fiddle doesn't actually include jQuery via a script tag.

e.g. add: <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> to your HMTL

0
0

you must add below line after last div between body tag :

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4
/jquery.min.js"></script>

Here is Demo

0

Add the cdn link for Jquery. Without jquery it will not work. You can add it to the before end of body tag.

Add:<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

0

use jquery online by adding <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>.

<html>
<head></head>
<title></title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>


<body>
 <button id="check">Click on me to check if jquery is working ....!</button>
</body>

<script type="text/javascript">
$("#check").click(function(){
  alert("yep, jquery is working");
});


</script>

</html>

0

every thing looks fine please select jquery in fiddle then try it and please add this script code in your file < script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" ></script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.