How to quickly add jQuery to your web page

Too lazy to type? Copy my code below:

<!doctype html>
<html>
<head>
<title>jQuery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery-1.10.2.min.js" type="text/javascript"></script>
</head>

<body>
Click me to test
<script>
$('body').click(function(){
alert('jQuery is working');
});

</script>

</body>

</html>


Written instructions:

-Create a blank html file inside a root folder

-Then add the most basic html tags

-Google for jquery and click on the download button

-Save the result in the root folder by right-clicking on it and choosing save as

-Copy the file name of the jquery file and paste it inside the head section

-Surround it by script tags and remember to also add the .js extension to the file name

-Lastly add some code to test if the jquery is working properly

-This code should trigger an alert message if you click anywhere inside body of the html document

Leave a Reply

Your email address will not be published.