Advanced Web Technologies: Jquery
Advanced Web Technologies: Jquery
Chapter : 3
jQuery
submitted by:
kinjal patni
content
Introduction to JQUERY
JQUERY Effects
JQUERY and HTML
JQUERY Traversing
Introduction to JQUERY
jQuery is a fast and concise JavaScript Library created by John Resig in 2006 with a
nice motto: Write less, do more.
jQuery simplifies HTML document traversing, event handling, animating, and Ajax
interactions for rapid web development.
jQuery is a JavaScript toolkit designed to simplify various tasks by writing less
code.
jQuery is a lightweight JavaScript library.
jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX
calls and DOM manipulation.
features of JQUERY
Here is the list of important core features supported by jQuery −
DOM manipulation − The jQuery made it easy to select DOM elements, negotiate them and
modifying their content by using cross-browser open source selector engine called Sizzle.
Event handling − The jQuery offers an elegant way to capture a wide variety of events, such as
a user clicking on a link, without the need to clutter the HTML code itself with event handlers.
AJAX Support − The jQuery helps you a lot to develop a responsive and feature rich site using
AJAX technology.
Animations − The jQuery comes with plenty of built-in animation effects which you can use in
your websites.
Lightweight − The jQuery is very lightweight library - about 19KB in size (Minified and
gzipped).
Cross Browser Support − The jQuery has cross-browser support, and works well in IE 6.0+, FF
2.0+, Safari 3.0+, Chrome and Opera 9.0+
Latest Technology − The jQuery supports CSS3 selectors and basic XPath syntax.
Why jQuery is required
Sometimes, a question can arise that what is the need of jQuery or what difference
it makes on bringing jQuery instead of AJAX/ JavaScript? If jQuery is the
replacement of AJAX and JavaScript? For all these questions, you can state the
following answers.
It is very fast and extensible.
It facilitates the users to write UI (User Interface) related function codes in
minimum possible lines.
It improves the performance of an application.
Browser's compatible web applications can be developed.
It uses mostly new features of new browsers.
Why jQuery is required
So, you can say that out of the lot of JavaScript frameworks, jQuery is the most
popular and the most extendable. Many of the biggest companies on the web use
jQuery.
Some of these companies are:
Microsoft
Google
IBM
Netflix
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).
How to use JQUERY?
Local Installation
Go to the https://jquery.com/download/ to download the latest version available.
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>
How to use JQUERY?
CDN Based Version
You can include jQuery library into your HTML code directly from Content
Delivery Network (CDN).
Source Code available:
1) src = " https://code.jquery.com/jquery-3.6.0.js “
Example
Now let us rewrite above example using jQuery library from CDN.
<html>
<head>
<title>The jQuery Example</title>
<script type = "text/javascript" src = "https://code.jquery.com/jquery-3.6.0.js" >
</script>
<script type = "text/javascript">
$(document).ready(function()
{
document.write("Hello, World!"); });
</script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>