SlideShare a Scribd company logo
jQuery is a JavaScript Library
-By Akanksha Sawarkar
What is jQuery?
• jQuery is a lightweight library.
• jQuery is a fast, small, and feature-rich JavaScript library.
• It makes things like HTML document traversal and
manipulation, event handling, animation. With a
combination of versatility and extensibility, jQuery has
changed the way that millions of people write JavaScript.
• jQuery takes a lot of common tasks that require many
lines of JavaScript code to accomplish, and wraps them
into methods that you can call with a single line of code.
History of jQuery
• jQuery, the fantastic JavaScript library invented by John Resig.
• On August 22nd, 2005 First stable 1.0 version was released & latest one
i.e. jQuery 2.0 Beta 2 was realeased onMarch 1st, 2013 .
• jQuery 2.0 is intended for the modern web
• How 2.0 Changed
• No more support for IE 6/7/8
• Reduced size : The final 2.0.0 file is 12 percent smaller than the 1.9.1
• Custom builds for even smaller files
• jQuery 1.9 API equivalence: jQuery 2.0 is API-compatible with 1.9, which
means that all of the changes documented in the
jQuery 1.9 Upgrade Guide have been applied to jQuery 2.0 as well.
Features & Benefits with JQuery
• The jQuery library contains the following features:
• HTML/DOM manipulation
• CSS manipulation
• HTML event methods
• Effects and animations
• AJAX
• Utilities
Why jQuery?
• There are a lots of other JavaScript frameworks out
there, but jQuery seems to be the most popular, and
also the most extendable.
• Many of the biggest companies on the Web use
jQuery, such as:
• Google
• Microsoft
• IBM
• Netflix
How to include a hosted copy of
jQuery
• go to the CDN Hosted jQuery section of the
download page and pick one of the different CDN
services available;
• copy the URL of your CDN of choice and paste it as
the value of the <script> tag's src attribute, like so:
• <script type="text/javascript"
src"yourCDNUrlAddressjQueryFile.js"></script>place
a <script> tag with a reference to your own
JavaScript file underneath the jQuery <script> tag
jQuery Syntax
• The jQuery syntax is tailor made for selecting HTML
elements and performing some action on the
element(s).
• Basic syntax is: $(selector).action()
• A $ sign to define/access jQuery
• A (selector) to "query (or find)" HTML elements
• A jQuery action() to be performed on the element(s)
$(document).ready(function(){
// jQuery methods go here...
});
• Examples:
• $(this).hide() - hides the current element.
• $("p").hide() - hides all <p> elements.
• $(".test").hide() - hides all elements with
class="test".
• $("#test").hide() - hides the element with
id="test".
jQuery Selectors
• jQuery selectors allow you to select and manipulate HTML element(s).
• jQuery selectors are used to "find" (or select) HTML elements based on
their id, classes, types, attributes, values of attributes and much more. It's
based on the existing CSS Selectors, and in addition, it has some own
custom selectors.
• All selectors in jQuery start with the dollar sign and parentheses: $().
• You can select all <p> elements on a page like this:
• $("p")
• Example
• When a user clicks on a button, all <p> elements will be hidden:
• Example
• $(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
Functions In a Separate File
• If your website contains a lot of pages, and you want
your jQuery functions to be easy to maintain, you
can put your jQuery functions in a separate .js file.
• Example
• <head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.1
0.2/jquery.min.js">
</script>
<script src="my_jquery_functions.js"></script>
</head>
Events
• jQuery provides simple methods for attaching
event handlers to selections. When an event
occurs, the provided function is executed.
Inside the function, this refers to the element
that was clicked.
Mouse Events Keyboard Events Form Events Document/Window
Events
click keypress submit load
dblclick keydown change resize
mouseenter keyup focus scroll
mouseleave blur unload
• click()
• The click() method attaches an event handler
function to an HTML element
• When a click event fires on a <p> element;
hide the current <p> element:
• Example
• $("p").click(function(){
$(this).hide();
});
J query presentation
Effects
• jQuery makes it trivial to add simple effects to your
page. Effects can use the built-in settings, or provide
a customized duration. You can also create custom
animations of arbitrary CSS properties
• jQuery Effects
• Hide, Show, Toggle, Slide, Fade, and Animate.
jQuery hide() and show()
• With jQuery, you can hide and show HTML elements
with the hide() and show() methods:
J query presentation
• jQuery toggle()
• With jQuery, you can toggle between the hide() and
show() methods with the toggle() method.
• jQuery Fading Methods
• With jQuery you can fade an element in and out of
visibility.
• jQuery has the following fade methods:
• fadeIn()
• fadeOut()
• fadeToggle()
• fadeTo()
J query presentation
• jQuery Sliding Methods
• With jQuery you can create a sliding effect on elements.
• jQuery has the following slide methods:
• slideDown()
• slideUp()
• slideToggle()
jQuery Effects – Animation
• The jQuery animate() method lets you create custom animations.
• Syntax:
• $(selector).animate({params},speed,callback);
jQuery stop() Method
• The jQuery stop() method is used to stop an animation or effect
before it is finished
• Syntax:
• $(selector).stop(stopAll,goToEnd);
Chaining
• Chaining allows us to run multiple jQuery
methods (on the same element) within a
single statement.
• that allows us to run multiple jQuery
commands, one after the other, on the same
element(s).
• Ex: $("#p1").css("color","red")
.slideUp(2000)
.slideDown(2000);
DOM Manipulation
• DOM = Document Object Model
The DOM defines a standard for accessing HTML and XML
documents:
"The W3C Document Object Model (DOM) is a platform
and language-neutral interface that allows programs and
scripts to dynamically access and update the content,
structure, and style of a document.“
Get Content - text(), html(), and val()
• Three simple, but useful, jQuery methods for DOM
manipulation are:
• text() - Sets or returns the text content of selected
elements
• html() - Sets or returns the content of selected elements
(including HTML markup)
• val() - Sets or returns the value of form fields
Add New HTML Content
We will look at four jQuery methods that are
used to add new content:
• append() - Inserts content at the end of the
selected elements
• prepend() - Inserts content at the beginning of
the selected elements
• after() - Inserts content after the selected
elements
• before() - Inserts content before the selected
elements
• remove() -method removes the selected
element(s) and its child elements.
Manipulating CSS
jQuery has several methods for CSS manipulation
• addClass() - Adds one or more classes to the
selected elements
• removeClass() - Removes one or more classes
from the selected elements
• toggleClass() - Toggles between adding/removing
classes from the selected elements
• css() - Sets or returns the style attribute
To set a specified CSS property, use the following
syntax:
• css("propertyname","value");
Dimensions
• jQuery has several important methods for
working with dimensions:
• width()
• height()
• innerWidth()
• innerHeight()
• outerWidth()
• outerHeight()
Traversing
• jQuery traversing, which means "move
through", are used to "find" (or select) HTML
elements based on their relation to other
elements. Start with one selection and move
through that selection until you reach the
elements you desire.
• Three useful jQuery methods for traversing up
the DOM tree are:
• parent()
• parents()
• parentsUntil()
Plugins
• A jQuery plugin is simply a new method that we use to extend
jQuery's prototype object. By extending the prototype object
you enable all jQuery objects to inherit any methods that you
add. As established, whenever you call jQuery() you're creating a
new jQuery object, with all of jQuery's methods inherited.
• The idea of a plugin is to do something with a collection of
elements. You could consider each method that comes with the
jQuery core a plugin, like .fadeOut() or .addClass().
• Why to write plugin?
• Sometimes you want to make a piece of functionality available
throughout your code. For example, perhaps you want a single
method you can call on a jQuery selection that performs a series
of operations on the selection. Maybe you wrote a really useful
utility function that you want to be able to move easily to other
projects
ADVANTAGES AND DISADVANTAGES
Advantages:
• Ease of use
This is pretty much the main advantage of using JQuery, it is a lot more easy
to use compared to standard javascript and other javascript libraries. Apart
from simple syntax, it also requires much less lines of code to achieve the
same feature in comparison.
• Large library
JQuery enables you to perform hordes of functions in comparison to other
Javascript libraries.
• Strong opensource community. (Several jQuery plugins available)
JQuery, while relatively new, has a following that religiously devote their
time to develop and enhance the functionality of JQuery. Thus there are
hundreds of prewritten plugins available for download to instantly speed up
your development process. Another advantage behind this is the efficiency
and security of the script.
• Great documentation and tutorials
The JQuery website has a comprehensive documentation and tutorials to
get even an absolute beginner in programming to get the ball rolling with
this library.
• Ajax support
JQuery lets you develop Ajax templates with ease, Ajax enables a sleeker
interface where actions can be performed on pages without requiring the
entire page to be reloaded
Disadvantages
• Functionality maybe limited
While JQuery has an impressive library in terms of
quantity, depending on how much customization you
require on your website, functionality maybe limited
thus using raw javascript maybe inevitable in some
cases.
• JQuery javascript file required
The JQuery javascript file is required to run JQuery
commands, while the size of this file is relatively small
(25-100KB depending on server), it is still a strain on the
client computer and maybe your web server as well if
you intend to host the JQuery script on your own web
server.
Thank You

More Related Content

PPT
J query b_dotnet_ug_meet_12_may_2012
PPTX
Getting started with jQuery
PDF
jQuery Introduction
PDF
DirectToWeb 2.0
PDF
D2W Branding Using jQuery ThemeRoller
PDF
JavaScript Library Overview (Ajax Exp West 2007)
PDF
D3.js and SVG
PPTX
Getting Started with jQuery
J query b_dotnet_ug_meet_12_may_2012
Getting started with jQuery
jQuery Introduction
DirectToWeb 2.0
D2W Branding Using jQuery ThemeRoller
JavaScript Library Overview (Ajax Exp West 2007)
D3.js and SVG
Getting Started with jQuery

What's hot (19)

PDF
Introduction to jQuery (Ajax Exp 2007)
ODP
Html5
PDF
State of jQuery and Drupal
ZIP
Contextual jQuery
PDF
Advanced jQuery (Ajax Exp 2007)
PPTX
e-suap - client technologies- english version
PPTX
How dojo works
PPT
Introduction to j query
ZIP
Presentational jQuery
PPSX
JQuery Comprehensive Overview
PPTX
Svcc 2013-css3-and-mobile
PPTX
J query resh
PPTX
JavaScript and jQuery Basics
PDF
jQuery in the [Aol.] Enterprise
PDF
Local storage in Web apps
PDF
Web2.0 with jQuery in English
PPTX
Getting Started with Javascript
PPTX
Introduction to j_query
Introduction to jQuery (Ajax Exp 2007)
Html5
State of jQuery and Drupal
Contextual jQuery
Advanced jQuery (Ajax Exp 2007)
e-suap - client technologies- english version
How dojo works
Introduction to j query
Presentational jQuery
JQuery Comprehensive Overview
Svcc 2013-css3-and-mobile
J query resh
JavaScript and jQuery Basics
jQuery in the [Aol.] Enterprise
Local storage in Web apps
Web2.0 with jQuery in English
Getting Started with Javascript
Introduction to j_query
Ad

Similar to J query presentation (20)

PPTX
Getting Started with jQuery
PPT
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
PPTX
Web technologies-course 11.pptx
PPTX
Jquery Complete Presentation along with Javascript Basics
PPTX
J Query The Write Less Do More Javascript Library
PPTX
Upstate CSCI 450 jQuery
PPTX
PPTX
jQuery - Web Engineering
PPT
jQuery For Beginners - jQuery Conference 2009
PDF
Introduction to jQuery
PPTX
JQuery_and_Ajax.pptx
PDF
jQuery Interview Questions By ScholarHat.pdf
PPTX
jQuery - the world's most popular java script library comes to XPages
PPT
JQuery introduction
PPT
jQuery Introduction/ jquery basic concept
PDF
Jquery tutorial-beginners
PPTX
Jqueryppt (1)
PDF
jQuery (DrupalCamp Toronto)
Getting Started with jQuery
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
Web technologies-course 11.pptx
Jquery Complete Presentation along with Javascript Basics
J Query The Write Less Do More Javascript Library
Upstate CSCI 450 jQuery
jQuery - Web Engineering
jQuery For Beginners - jQuery Conference 2009
Introduction to jQuery
JQuery_and_Ajax.pptx
jQuery Interview Questions By ScholarHat.pdf
jQuery - the world's most popular java script library comes to XPages
JQuery introduction
jQuery Introduction/ jquery basic concept
Jquery tutorial-beginners
Jqueryppt (1)
jQuery (DrupalCamp Toronto)
Ad

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced IT Governance
PDF
Machine learning based COVID-19 study performance prediction
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Electronic commerce courselecture one. Pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.
Advanced IT Governance
Machine learning based COVID-19 study performance prediction
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Monthly Chronicles - July 2025
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced methodologies resolving dimensionality complications for autism neur...
Advanced Soft Computing BINUS July 2025.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Electronic commerce courselecture one. Pdf
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
cuic standard and advanced reporting.pdf

J query presentation

  • 1. jQuery is a JavaScript Library -By Akanksha Sawarkar
  • 2. What is jQuery? • jQuery is a lightweight library. • jQuery is a fast, small, and feature-rich JavaScript library. • It makes things like HTML document traversal and manipulation, event handling, animation. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript. • jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.
  • 3. History of jQuery • jQuery, the fantastic JavaScript library invented by John Resig. • On August 22nd, 2005 First stable 1.0 version was released & latest one i.e. jQuery 2.0 Beta 2 was realeased onMarch 1st, 2013 . • jQuery 2.0 is intended for the modern web • How 2.0 Changed • No more support for IE 6/7/8 • Reduced size : The final 2.0.0 file is 12 percent smaller than the 1.9.1 • Custom builds for even smaller files • jQuery 1.9 API equivalence: jQuery 2.0 is API-compatible with 1.9, which means that all of the changes documented in the jQuery 1.9 Upgrade Guide have been applied to jQuery 2.0 as well.
  • 4. Features & Benefits with JQuery • The jQuery library contains the following features: • HTML/DOM manipulation • CSS manipulation • HTML event methods • Effects and animations • AJAX • Utilities
  • 5. Why jQuery? • There are a lots of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most extendable. • Many of the biggest companies on the Web use jQuery, such as: • Google • Microsoft • IBM • Netflix
  • 6. How to include a hosted copy of jQuery • go to the CDN Hosted jQuery section of the download page and pick one of the different CDN services available; • copy the URL of your CDN of choice and paste it as the value of the <script> tag's src attribute, like so: • <script type="text/javascript" src"yourCDNUrlAddressjQueryFile.js"></script>place a <script> tag with a reference to your own JavaScript file underneath the jQuery <script> tag
  • 7. jQuery Syntax • The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s). • Basic syntax is: $(selector).action() • A $ sign to define/access jQuery • A (selector) to "query (or find)" HTML elements • A jQuery action() to be performed on the element(s) $(document).ready(function(){ // jQuery methods go here... });
  • 8. • Examples: • $(this).hide() - hides the current element. • $("p").hide() - hides all <p> elements. • $(".test").hide() - hides all elements with class="test". • $("#test").hide() - hides the element with id="test".
  • 9. jQuery Selectors • jQuery selectors allow you to select and manipulate HTML element(s). • jQuery selectors are used to "find" (or select) HTML elements based on their id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors. • All selectors in jQuery start with the dollar sign and parentheses: $(). • You can select all <p> elements on a page like this: • $("p") • Example • When a user clicks on a button, all <p> elements will be hidden: • Example • $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); });
  • 10. Functions In a Separate File • If your website contains a lot of pages, and you want your jQuery functions to be easy to maintain, you can put your jQuery functions in a separate .js file. • Example • <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.1 0.2/jquery.min.js"> </script> <script src="my_jquery_functions.js"></script> </head>
  • 11. Events • jQuery provides simple methods for attaching event handlers to selections. When an event occurs, the provided function is executed. Inside the function, this refers to the element that was clicked. Mouse Events Keyboard Events Form Events Document/Window Events click keypress submit load dblclick keydown change resize mouseenter keyup focus scroll mouseleave blur unload
  • 12. • click() • The click() method attaches an event handler function to an HTML element • When a click event fires on a <p> element; hide the current <p> element: • Example • $("p").click(function(){ $(this).hide(); });
  • 14. Effects • jQuery makes it trivial to add simple effects to your page. Effects can use the built-in settings, or provide a customized duration. You can also create custom animations of arbitrary CSS properties • jQuery Effects • Hide, Show, Toggle, Slide, Fade, and Animate. jQuery hide() and show() • With jQuery, you can hide and show HTML elements with the hide() and show() methods:
  • 16. • jQuery toggle() • With jQuery, you can toggle between the hide() and show() methods with the toggle() method. • jQuery Fading Methods • With jQuery you can fade an element in and out of visibility. • jQuery has the following fade methods: • fadeIn() • fadeOut() • fadeToggle() • fadeTo()
  • 18. • jQuery Sliding Methods • With jQuery you can create a sliding effect on elements. • jQuery has the following slide methods: • slideDown() • slideUp() • slideToggle() jQuery Effects – Animation • The jQuery animate() method lets you create custom animations. • Syntax: • $(selector).animate({params},speed,callback); jQuery stop() Method • The jQuery stop() method is used to stop an animation or effect before it is finished • Syntax: • $(selector).stop(stopAll,goToEnd);
  • 19. Chaining • Chaining allows us to run multiple jQuery methods (on the same element) within a single statement. • that allows us to run multiple jQuery commands, one after the other, on the same element(s). • Ex: $("#p1").css("color","red") .slideUp(2000) .slideDown(2000);
  • 20. DOM Manipulation • DOM = Document Object Model The DOM defines a standard for accessing HTML and XML documents: "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.“ Get Content - text(), html(), and val() • Three simple, but useful, jQuery methods for DOM manipulation are: • text() - Sets or returns the text content of selected elements • html() - Sets or returns the content of selected elements (including HTML markup) • val() - Sets or returns the value of form fields
  • 21. Add New HTML Content We will look at four jQuery methods that are used to add new content: • append() - Inserts content at the end of the selected elements • prepend() - Inserts content at the beginning of the selected elements • after() - Inserts content after the selected elements • before() - Inserts content before the selected elements • remove() -method removes the selected element(s) and its child elements.
  • 22. Manipulating CSS jQuery has several methods for CSS manipulation • addClass() - Adds one or more classes to the selected elements • removeClass() - Removes one or more classes from the selected elements • toggleClass() - Toggles between adding/removing classes from the selected elements • css() - Sets or returns the style attribute To set a specified CSS property, use the following syntax: • css("propertyname","value");
  • 23. Dimensions • jQuery has several important methods for working with dimensions: • width() • height() • innerWidth() • innerHeight() • outerWidth() • outerHeight()
  • 24. Traversing • jQuery traversing, which means "move through", are used to "find" (or select) HTML elements based on their relation to other elements. Start with one selection and move through that selection until you reach the elements you desire. • Three useful jQuery methods for traversing up the DOM tree are: • parent() • parents() • parentsUntil()
  • 25. Plugins • A jQuery plugin is simply a new method that we use to extend jQuery's prototype object. By extending the prototype object you enable all jQuery objects to inherit any methods that you add. As established, whenever you call jQuery() you're creating a new jQuery object, with all of jQuery's methods inherited. • The idea of a plugin is to do something with a collection of elements. You could consider each method that comes with the jQuery core a plugin, like .fadeOut() or .addClass(). • Why to write plugin? • Sometimes you want to make a piece of functionality available throughout your code. For example, perhaps you want a single method you can call on a jQuery selection that performs a series of operations on the selection. Maybe you wrote a really useful utility function that you want to be able to move easily to other projects
  • 26. ADVANTAGES AND DISADVANTAGES Advantages: • Ease of use This is pretty much the main advantage of using JQuery, it is a lot more easy to use compared to standard javascript and other javascript libraries. Apart from simple syntax, it also requires much less lines of code to achieve the same feature in comparison. • Large library JQuery enables you to perform hordes of functions in comparison to other Javascript libraries. • Strong opensource community. (Several jQuery plugins available) JQuery, while relatively new, has a following that religiously devote their time to develop and enhance the functionality of JQuery. Thus there are hundreds of prewritten plugins available for download to instantly speed up your development process. Another advantage behind this is the efficiency and security of the script. • Great documentation and tutorials The JQuery website has a comprehensive documentation and tutorials to get even an absolute beginner in programming to get the ball rolling with this library. • Ajax support JQuery lets you develop Ajax templates with ease, Ajax enables a sleeker interface where actions can be performed on pages without requiring the entire page to be reloaded
  • 27. Disadvantages • Functionality maybe limited While JQuery has an impressive library in terms of quantity, depending on how much customization you require on your website, functionality maybe limited thus using raw javascript maybe inevitable in some cases. • JQuery javascript file required The JQuery javascript file is required to run JQuery commands, while the size of this file is relatively small (25-100KB depending on server), it is still a strain on the client computer and maybe your web server as well if you intend to host the JQuery script on your own web server.