JavaScript Tutorial JavaScript Examples jQuery Tutorial CSS Tutorial HTML Tutorial About Us

Lesson 1 Introduction to jQuery


jQuery is a kind of JavaScript that you can include in your webpages. It enables you to search for HTML elements using CSS-style selectors and then perform some actions on the elements. Developers like to use jQuery because it makes coding in JavaScript much simpler.

For example, instead of using the DOM method document.getElementById("demo").innerHTML() to get the content of an element, you can use $("#demo").text() to achieve the same purpose with much shorter code.

Before you can use jQuery, you need to download the jQuery file from http://jQuery.com/download/. The jQuery library is a single JavaScript file, and you reference it with the HTML <script> tag inside the <head> section, as follows:

<head>
<script src="jQuery-3.3.1.min.js"></script>
</head>

Alternatively, you can use the jQuery file without having to download it, instead, you can include it from a CDN (Content Delivery Network). that host jQuery. For example,both Google and Microsoft host jQuery. To use jQuery from Google CDN, use of the following:

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

To use jQuery from Microsoft CDN, use of the following:

<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jQuery-3.3.1.min.js""></script>
</head>

By the way, you need to have good grasp of HTML, JavaScript and CSS before learning jQuery. Otherwise, please visit our HTML & CSS tutorial and JavaScript Tutorial to learn the basics of HTML, CSS and JavaScript.



❮ Home Next Lesson ❯


Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy