Not working


#1

Guys i thought sometime that i learned enough jQuary so i thought i test my skils on computer
I used notepad++
Now when i made a js file and insrted my JQuary code it doesn't work i linked it but still not
My code on the Html file:

<html>
	<head>
		<title>animate</title>
		<script type='text/javascript' src='script.js'></script>
	</head>
	<body>
		<div style="background-color:red; width:100px; height:100px; border-radius:5px;display:inline-block"></div>
		<div style="background-color:yellow; width:100px; height:100px; border-radius:5px;display:inline-block"></div>
		<div style="background-color:blue; width:100px; height:100px; border-radius:5px;display:inline-block"></div>
		<div style="background-color:green; width:100px; height:100px; border-radius:5px;display:inline-block"></div>		
	</body>
</html>

Its big right?
Anyways

My code in the js file(jQuary):

$(document).ready(function() {
	$('div').click(function(){
		$(this).hide();
	});
});

But nothing happens when i click in the page
Did i make something wrong

In CodeCademy it works just fine.


#2

jquery is a javascript library, you need to include a jquery library for jquery code to work.

You can download it from the jquery website download page (link) or use the google hosted library's


#3

Ok i did and download it what should i do now
Do i need to include it in my HTML file or what please fast answer


#4

you should a script tag (<script>) and point to the jquery file yes, and i would place it above the file which points to script.js


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.