JQuery Classroom image

Gaurav  Raturi / Teacher / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  ||
Lessons:-How to use jQuery?

How to use jQuery?
There are two ways to use jQuery.
Local Installation − You can download jQuery library on your local machine and include it in your HTML code.
CDN Based Version − You can include jQuery library into your HTML code directly from Content Delivery Network (CDN).

Local Installation
Go to the https://jquery.com/download/ to download the latest version available.
Now, insert downloaded jquery-2.1.3.min.js file in a directory of your website, e.g. /jquery.
Example
Now, you can include jquery library in your HTML file as follows:
<html>
<head>
<title>The jQuery Example</title>
<script type="text/javascript" src="/jquery/jquery-2.1.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
document.write("Hello, World!");
});
</script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
This will produce the following result −
Hello, World!

CDN version of the library throughout this tutorial.
Example
Now let us rewrite above example using jQuery library from Google CDN.
<html>
<head>
<title>The jQuery Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
document.write("Hello, World!");
});
</script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
This will produce the following result:
Hello, World!

 
 
 
image
Gaurav  Raturi

Skills    JQuery

Qualifications :-
Location :-Tehri,Dehradun,Uttarakhand,India
Description:-

5 year of experience in web development , have good experience in jquery, php,css and html .


Explore
 

  Students (0)