Hi I am trying to try out some jQuery and having no luck at all. Was writing code and what not and nothing was working. So I tried some JQuery from w3schools and that didn’t even work.
Any idea why I cant get it to work?
I have this in the head of my html
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Still doesn’t work.
Grateful for any help Thanks
Mikey
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeIn();
$("#div2").fadeIn("slow");
$("#div3").fadeIn(3000);
});
});
</script>
</head>
<body>
<p>Demonstrate fadeIn() with different parameters.</p>
<button>Click to fade in boxes</button>
<br><br>
<div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div> <br>
<div id="div2" style="width:80px;height:80px;display:none;background-color:green;"> </div><br>
<div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"> </div>
</body>
</html>
Copied that into notepad, saved it then ran it in chrome, when I pressed the button nothing happened.
Thank you to everyone who help
The problem here is the scheme relative url that you are using to load jQuery. Since I assume you are loading the html file locally, your page’s scheme is
file://. When you go to load jQuery using//as the source it is looking on your local filesystem for a folder calledajax.googleapis.com. Replace//in your script tag withhttps://to solve your problem.