SlideShare a Scribd company logo
1

Girish Srivastava
girish092.ch@gmail.com
Objective
 In this tutorial, we will learn everything about the jQuery. After completing the tutorial

you will be able to understand about jQuery.
 This jQuery tutorial covers:
Introduction to jQuery
 Features of jQuery
 Comparison between different tool kits
 Jquery Selectors


2
What’s the problem
? with JavaScript
JavaScript was a initially introduced in
Netscape 2.0B3 in Dec 1995,
LiveScript, Jscript, however, it’s official
name is
ECMAScript
JavaScript is a C-family, world’s worst
named, extremely powerful language (not
a script), totally unrelated to Java
JavaScript is a weakly typed, classless,
prototype based OO language, that can
also be used outside the browser. It is not
a browser DOM.
The world’s most misunderstood
programming language.

(Douglas Crockford)
Browser DOM really sucks, and this is
where jQuery comes to rescue.
This session is about improving
your Quality of Life !
Introduction to jQuery
A Little Bit About jQuery
What is jQuery?
•jQuery is an Open-Source JavaScript framework that simplifies crossbrowser client side scripting.
• Animations
• DOM manipulation
• AJAX
• Extensibility through plugins

•jQuery was created by John Resig and released 01/06
•Most current release is 1.7.2 (3/19/12)

11
A Little Bit About jQuery
Why should you use it?
•Easy to learn! It uses CSS syntax for selection
•Its tiny 71KB (24KB, minified and Gzipped)
•Documented api.jquery.com & Supported forum.jquery.com

•Cross browser compatibility: IE 6+, FF 2+
•It is the most used JavaScript library on the web today
• 39% of all sites that use JavaScript use jQuery.
 trends.builtwith.com/javascript/JQuery <- See, I'm not a liar..

12
Features Of Jquery.

 jQuery includes the following features:

 DOM element selections using the cross-browser open source selector engine Sizzle, a spin-

off out of the jQuery project
 DOM traversal and modification (including support for CSS 1-3)
 DOM manipulation based on CSS selectors that uses node elements name and node elements
attributes (id and class) as criteria to build selectors
 Events
 Effects and animations
 Ajax
 Extensibility through plug-ins
 Cross-browser support

13
All Other Frameworks

14
Who Uses jQuery?

docs.jquery.com/Sites_Using_jQuery
15
JQuery versus Dojo versus YUI

16
17
When we compare these 3 libraries/frameworks, I found
the following which was quite useful.
http://selectors.turnwheel.com/slickspeed.php

18
jQuery vs MooTools
Library Size

jQuery Core
55.9K

MooTools Core
64.3K

Features
License
DOM Utilites

MIT & GPL
yes

MIT
yes

Animation
Event Handling

yes
yes

yes
yes

CSS3 Selectors
Ajax

yes (a subset)
yes

yes (a subset)
yes

Native Extensions (excluding about a dozen for Array,
Element)
Object, and String

about six dozen for Array,
Object, String, Function, and
Number

Inheritance

Provided with Class
 constructor

19

Not supported directly with
jQuery
The Mottos Say It All
If you go to the jQuery site, here's what it says at the top of the page:

o jQuery is a fast and concise JavaScript Library that
simplifies HTML document traversing, event handling,
animating, and Ajax interactions for rapid web
development. jQuery is designed to change the way
that you write JavaScript.
...and if you go to MooTools, this is what you'll find:

o MooTools is a compact, modular, Object-Oriented
JavaScript framework designed for the intermediate to
advanced JavaScript developer. It allows you to write
powerful, flexible, and cross-browser code with its
elegant, well documented, and coherent API.
20
21
Historical trend
 This diagram shows the historical trend in the percentage of websites using JQuery.

22
position
 This diagram shows the market positions in terms of popularity and traffic of the 5 most

popular JavaScript libraries. 

23
What is the DOM?

Document Object Model
(DOM): noun
Blah blah blah long definition
that makes little sense….
24
What Is The DOM?
 Long story short, the DOM is your html document code. From

the
 <!DOCTYPE> to the </html>

 The DOM is loaded top to bottom, so include your scripts at the

bottom of the page for best performance.

 The DOM is "ready" when everything on the page has loaded.
• Stylesheets
• JavaScripts
• Images

25
Wait!!
 In order to make sure that jQuery can find the element you asked

it for, your browser needs to have loaded it (the DOM needs to
be ready).
 Q. How can I be sure my code runs at DOM ready?



A. Wrap all your jQuery code with the document ready function:

$(document).ready(function(){

});

26

// insert sweet, sweet jQuery code here…
And What If I Don't Wanna, Huh?
1 of 3 things will happen:
1.

Code doesn't work, throws an error (90%)

Code works… this page load, next page load see #1. (~9%)
3. Code opens a worm hole that transports your page back to 1990
revolutionizing the Web as we know it. While seemingly great, it
also creates a paradox and destroys the universe. * (<1%)
2.



27

*(has yet to be fully verified)
jQuery Core Concepts
The Magic $() function

var el = $(“<div/>”)

Create HTML elements on the fly
The Magic $() function

$(window).width()

Manipulate existing DOM elements
The Magic $() function

$(“div”).hide();
$(“div”, $(“p”)).hide();
Selects document elements
(more in a moment…)
The Magic $() function
$(function(){…});
Fired when the document is ready for programming.
Better use the full syntax:
$(document).ready(function(){…});
Loading jQuery
In order to use jQuery you need to load it.
You can include it locally on your own server:
 <script src="/js/jquery.js">

Or use one of the CDN's made available:
 ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
 ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js
 CDN's are Gzipped and minified

33
Load Scripts At The Bottom
Problem:
When scripts are downloading they block everything else in almost all browsers!
Solution:
Best practice: Load your scripts at the bottom of your page so they don't interrupt page content downloads.

34
jQuery Syntax
The jQuery syntax is tailor made for selecting HTML

elements and perform some action on the element(s).
Basic syntax is: $(selector).action()
A dollar sign to define jQuery
A (selector) to "query (or find)" HTML elements
A jQuery action() to be performed on the
element(s)

35
Three Major Concepts of jQuery

The $() function

Get > Act

Chainability
jQuery Selectors
All Selector

$(“*”)

// find everything

Selectors return a pseudo-array of jQuery elements
Basic Selectors
By Tag:

$(“div”)
// <div>Hello jQuery</div>

By ID:

$(“#usr”)
// <span id=“usr”>John</span>

By Class:

$(“.menu”)
// <ul class=“menu”>Home</ul>

Yes, jQuery implements CSS Selectors!
And BOOM! Goes The Dynamite.
jsbin.com/ecayo3/18#slide19

Html:

<p>Hello World! I'm Eric</p>
Script:
$(function(){

$("p").addClass("isCool");
//keep telling yourself that..

});
Resulting html:

<p class="isCool">Hello World! I'm Eric</p>

40
Break It Down Now!

$(function(){// = $(document).ready(function(){

$

});
41

("p")

.addClass("isCool");
All Your Basic Selectors Are Belong To Us
Uses the same syntax you use to style elements in CSS!

api.jquery.com/category/selectors/
42
Get Classy <p>
jsbin.com/ecayo3/18#slide22

jQuery:

$("p").addClass("sophisticated");

Before:

<p>

After:

<p class="sophisticated">

43
This <p> Has No Class At All!
jQuery:

$("p").removeClass("sophisticated");

Before:

<p class="sophisticated">

After:

<p class="">

44
<div> Hide and Seek
jQuery:

$("div").show();

Before:

<div style="display:none;">

After:

<div style="display:block;">

45
I’m Not Lame, Am I?
jQuery:

$("#eric").text("Is Cool");

Before:

<p id="eric">Is Lame</p>

After:

<p id="eric">Is Cool</p>

46
You Can Chain Most Methods Together
$("p")




47

.addClass("sophisticated")
.text("Hello World!")
.show();
Some of Basic Methods

api.jquery.com/
48
A Simple Example:
 <html>

<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
</body>
</html>
49
Downloading jQuery
Two versions of jQuery are available for downloading: one minified

and one uncompressed (for debugging or reading).
Both versions can be downloaded from
 http://docs.jquery.com/Downloading_jQuery#Download_jQuery

50
Alternatives to Downloading
If you don't want to store the jQuery library on your own computer, you
can use the hosted jQuery library from Google or Microsoft.

Google

<head>
<script type="text/javascript"
src="http://ajax.googleapis.c
om/ajax/libs/jquery/1.4.2/jq
uery.min.js"></script>
</head>

51

Microsoft

<head>
<script
type="text/javascript"
src="http://ajax.microsoft.c
om/ajax/jquery/jquery1.4.2.min.js"></script>
</head>
Questions?
http://www.jquerymagic.com/
52
Plugins

53
Viva Variety!
“If you want to create an animation, effect or UI component,

chances are pretty good that someone has done your work
for you already.”

plugins.jquery.com

54
Great References
John Resig's introduction slides
jQuery 1.4 Cheat Sheet
jQuery API
jQuery Forums
YAYquery Podcast (explicit)
http://docs.jquery.com/How_

jQuery_Works
DEMOS:
jsbin.com/ecayo3/18
55
I Like Plugins!
Show Us More!

56
For any queries mail:
girish092.ch@gmail.com
57

More Related Content

What's hot

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
jQuery
jQueryjQuery
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
Jussi Pohjolainen
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
manugoel2003
 
Js ppt
Js pptJs ppt
Js ppt
Rakhi Thota
 
jQuery
jQueryjQuery
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
Adieu
 
jQuery
jQueryjQuery
jQuery
Vishwa Mohan
 
Css3
Css3Css3
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
Bala Narayanan
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
Anis Ahmad
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Dom
DomDom
Learn react-js
Learn react-jsLearn react-js

What's hot (20)

JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
jQuery
jQueryjQuery
jQuery
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Js ppt
Js pptJs ppt
Js ppt
 
jQuery
jQueryjQuery
jQuery
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 
jQuery
jQueryjQuery
jQuery
 
Css3
Css3Css3
Css3
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Dom
DomDom
Dom
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 

Viewers also liked

Web2.0 presentation c_macdonald
Web2.0 presentation c_macdonaldWeb2.0 presentation c_macdonald
Web2.0 presentation c_macdonald
Mac3Irish
 
Css
CssCss
15 Ways to be More Efficient - Master Presentation
15 Ways to be More Efficient - Master Presentation15 Ways to be More Efficient - Master Presentation
15 Ways to be More Efficient - Master Presentation
Yuri Piltser
 
Soccorso piccoli specie selvatiche2
Soccorso piccoli specie selvatiche2Soccorso piccoli specie selvatiche2
Soccorso piccoli specie selvatiche2
Umberto Bonaventura
 
demo open layer 2
demo open layer 2demo open layer 2
demo open layer 2
Adi Triyatmoko
 

Viewers also liked (6)

Web2.0 presentation c_macdonald
Web2.0 presentation c_macdonaldWeb2.0 presentation c_macdonald
Web2.0 presentation c_macdonald
 
Css
CssCss
Css
 
15 Ways to be More Efficient - Master Presentation
15 Ways to be More Efficient - Master Presentation15 Ways to be More Efficient - Master Presentation
15 Ways to be More Efficient - Master Presentation
 
Work out
Work outWork out
Work out
 
Soccorso piccoli specie selvatiche2
Soccorso piccoli specie selvatiche2Soccorso piccoli specie selvatiche2
Soccorso piccoli specie selvatiche2
 
demo open layer 2
demo open layer 2demo open layer 2
demo open layer 2
 

Similar to Jquery

Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
Anil Kumar
 
Top 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | EdurekaTop 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | Edureka
Edureka!
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
Mark Roden
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
Catherine Beltran
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
Catherine Beltran
 
J Query
J QueryJ Query
J Query
ravinxg
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
WebStackAcademy
 
jQuery From the Ground Up
jQuery From the Ground UpjQuery From the Ground Up
jQuery From the Ground Up
Kevin Griffin
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery Learning
Uzair Ali
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Nagaraju Sangam
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
JS Libraries and jQuery Overview
JS Libraries and jQuery OverviewJS Libraries and jQuery Overview
JS Libraries and jQuery Overview
Aleksandr Motsjonov
 
J query presentation
J query presentationJ query presentation
J query presentation
akanksha17
 
J query presentation
J query presentationJ query presentation
J query presentation
sawarkar17
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
William Myers
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
Manoj Bhuva
 
Lesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ayLesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ay
Codecademy Ren
 
JQuery
JQueryJQuery
JQuery
Jacob Nelson
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
rsnarayanan
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQuery
DanWooster1
 

Similar to Jquery (20)

Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Top 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | EdurekaTop 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | Edureka
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
Jquery beltranhomewrok
Jquery beltranhomewrokJquery beltranhomewrok
Jquery beltranhomewrok
 
J Query
J QueryJ Query
J Query
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
 
jQuery From the Ground Up
jQuery From the Ground UpjQuery From the Ground Up
jQuery From the Ground Up
 
jQuery Learning
jQuery LearningjQuery Learning
jQuery Learning
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
JS Libraries and jQuery Overview
JS Libraries and jQuery OverviewJS Libraries and jQuery Overview
JS Libraries and jQuery Overview
 
J query presentation
J query presentationJ query presentation
J query presentation
 
J query presentation
J query presentationJ query presentation
J query presentation
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
 
A to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java DeveloperA to Z about JQuery - Become Newbie to Expert Java Developer
A to Z about JQuery - Become Newbie to Expert Java Developer
 
Lesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ayLesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ay
 
JQuery
JQueryJQuery
JQuery
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQuery
 

More from Girish Srivastava

My tableau
My tableauMy tableau
My tableau
Girish Srivastava
 
IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)
Girish Srivastava
 
Jscript part2
Jscript part2Jscript part2
Jscript part2
Girish Srivastava
 
Extjs
ExtjsExtjs
Jive
JiveJive
Jscript part1
Jscript part1Jscript part1
Jscript part1
Girish Srivastava
 
Cgi
CgiCgi
Complete Dojo
Complete DojoComplete Dojo
Complete Dojo
Girish Srivastava
 
Dojo tutorial
Dojo tutorialDojo tutorial
Dojo tutorial
Girish Srivastava
 

More from Girish Srivastava (9)

My tableau
My tableauMy tableau
My tableau
 
IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)IBM Pure Data System for Analytics (Netezza)
IBM Pure Data System for Analytics (Netezza)
 
Jscript part2
Jscript part2Jscript part2
Jscript part2
 
Extjs
ExtjsExtjs
Extjs
 
Jive
JiveJive
Jive
 
Jscript part1
Jscript part1Jscript part1
Jscript part1
 
Cgi
CgiCgi
Cgi
 
Complete Dojo
Complete DojoComplete Dojo
Complete Dojo
 
Dojo tutorial
Dojo tutorialDojo tutorial
Dojo tutorial
 

Recently uploaded

論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
Enterprise Wired
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
Neo4j
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 

Recently uploaded (20)

論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf7 Most Powerful Solar Storms in the History of Earth.pdf
7 Most Powerful Solar Storms in the History of Earth.pdf
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfBT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdf
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 

Jquery

  • 2. Objective  In this tutorial, we will learn everything about the jQuery. After completing the tutorial you will be able to understand about jQuery.  This jQuery tutorial covers: Introduction to jQuery  Features of jQuery  Comparison between different tool kits  Jquery Selectors  2
  • 3. What’s the problem ? with JavaScript
  • 4. JavaScript was a initially introduced in Netscape 2.0B3 in Dec 1995, LiveScript, Jscript, however, it’s official name is ECMAScript
  • 5. JavaScript is a C-family, world’s worst named, extremely powerful language (not a script), totally unrelated to Java
  • 6. JavaScript is a weakly typed, classless, prototype based OO language, that can also be used outside the browser. It is not a browser DOM.
  • 7. The world’s most misunderstood programming language. (Douglas Crockford)
  • 8. Browser DOM really sucks, and this is where jQuery comes to rescue.
  • 9. This session is about improving your Quality of Life !
  • 11. A Little Bit About jQuery What is jQuery? •jQuery is an Open-Source JavaScript framework that simplifies crossbrowser client side scripting. • Animations • DOM manipulation • AJAX • Extensibility through plugins •jQuery was created by John Resig and released 01/06 •Most current release is 1.7.2 (3/19/12) 11
  • 12. A Little Bit About jQuery Why should you use it? •Easy to learn! It uses CSS syntax for selection •Its tiny 71KB (24KB, minified and Gzipped) •Documented api.jquery.com & Supported forum.jquery.com •Cross browser compatibility: IE 6+, FF 2+ •It is the most used JavaScript library on the web today • 39% of all sites that use JavaScript use jQuery.  trends.builtwith.com/javascript/JQuery <- See, I'm not a liar.. 12
  • 13. Features Of Jquery.  jQuery includes the following features:  DOM element selections using the cross-browser open source selector engine Sizzle, a spin- off out of the jQuery project  DOM traversal and modification (including support for CSS 1-3)  DOM manipulation based on CSS selectors that uses node elements name and node elements attributes (id and class) as criteria to build selectors  Events  Effects and animations  Ajax  Extensibility through plug-ins  Cross-browser support 13
  • 16. JQuery versus Dojo versus YUI 16
  • 17. 17
  • 18. When we compare these 3 libraries/frameworks, I found the following which was quite useful. http://selectors.turnwheel.com/slickspeed.php 18
  • 19. jQuery vs MooTools Library Size jQuery Core 55.9K MooTools Core 64.3K Features License DOM Utilites MIT & GPL yes MIT yes Animation Event Handling yes yes yes yes CSS3 Selectors Ajax yes (a subset) yes yes (a subset) yes Native Extensions (excluding about a dozen for Array, Element) Object, and String about six dozen for Array, Object, String, Function, and Number Inheritance Provided with Class  constructor 19 Not supported directly with jQuery
  • 20. The Mottos Say It All If you go to the jQuery site, here's what it says at the top of the page: o jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. ...and if you go to MooTools, this is what you'll find: o MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API. 20
  • 21. 21
  • 22. Historical trend  This diagram shows the historical trend in the percentage of websites using JQuery. 22
  • 23. position  This diagram shows the market positions in terms of popularity and traffic of the 5 most popular JavaScript libraries.  23
  • 24. What is the DOM? Document Object Model (DOM): noun Blah blah blah long definition that makes little sense…. 24
  • 25. What Is The DOM?  Long story short, the DOM is your html document code. From the  <!DOCTYPE> to the </html>  The DOM is loaded top to bottom, so include your scripts at the bottom of the page for best performance.  The DOM is "ready" when everything on the page has loaded. • Stylesheets • JavaScripts • Images 25
  • 26. Wait!!  In order to make sure that jQuery can find the element you asked it for, your browser needs to have loaded it (the DOM needs to be ready).  Q. How can I be sure my code runs at DOM ready?  A. Wrap all your jQuery code with the document ready function: $(document).ready(function(){  }); 26 // insert sweet, sweet jQuery code here…
  • 27. And What If I Don't Wanna, Huh? 1 of 3 things will happen: 1. Code doesn't work, throws an error (90%) Code works… this page load, next page load see #1. (~9%) 3. Code opens a worm hole that transports your page back to 1990 revolutionizing the Web as we know it. While seemingly great, it also creates a paradox and destroys the universe. * (<1%) 2.  27 *(has yet to be fully verified)
  • 29. The Magic $() function var el = $(“<div/>”) Create HTML elements on the fly
  • 30. The Magic $() function $(window).width() Manipulate existing DOM elements
  • 31. The Magic $() function $(“div”).hide(); $(“div”, $(“p”)).hide(); Selects document elements (more in a moment…)
  • 32. The Magic $() function $(function(){…}); Fired when the document is ready for programming. Better use the full syntax: $(document).ready(function(){…});
  • 33. Loading jQuery In order to use jQuery you need to load it. You can include it locally on your own server:  <script src="/js/jquery.js"> Or use one of the CDN's made available:  ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js  ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js  CDN's are Gzipped and minified 33
  • 34. Load Scripts At The Bottom Problem: When scripts are downloading they block everything else in almost all browsers! Solution: Best practice: Load your scripts at the bottom of your page so they don't interrupt page content downloads. 34
  • 35. jQuery Syntax The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s). Basic syntax is: $(selector).action() A dollar sign to define jQuery A (selector) to "query (or find)" HTML elements A jQuery action() to be performed on the element(s) 35
  • 36. Three Major Concepts of jQuery The $() function Get > Act Chainability
  • 38. All Selector $(“*”) // find everything Selectors return a pseudo-array of jQuery elements
  • 39. Basic Selectors By Tag: $(“div”) // <div>Hello jQuery</div> By ID: $(“#usr”) // <span id=“usr”>John</span> By Class: $(“.menu”) // <ul class=“menu”>Home</ul> Yes, jQuery implements CSS Selectors!
  • 40. And BOOM! Goes The Dynamite. jsbin.com/ecayo3/18#slide19 Html: <p>Hello World! I'm Eric</p> Script: $(function(){ $("p").addClass("isCool"); //keep telling yourself that.. }); Resulting html: <p class="isCool">Hello World! I'm Eric</p> 40
  • 41. Break It Down Now! $(function(){// = $(document).ready(function(){ $ }); 41 ("p") .addClass("isCool");
  • 42. All Your Basic Selectors Are Belong To Us Uses the same syntax you use to style elements in CSS! api.jquery.com/category/selectors/ 42
  • 44. This <p> Has No Class At All! jQuery: $("p").removeClass("sophisticated"); Before: <p class="sophisticated"> After: <p class=""> 44
  • 45. <div> Hide and Seek jQuery: $("div").show(); Before: <div style="display:none;"> After: <div style="display:block;"> 45
  • 46. I’m Not Lame, Am I? jQuery: $("#eric").text("Is Cool"); Before: <p id="eric">Is Lame</p> After: <p id="eric">Is Cool</p> 46
  • 47. You Can Chain Most Methods Together $("p")    47 .addClass("sophisticated") .text("Hello World!") .show();
  • 48. Some of Basic Methods api.jquery.com/ 48
  • 49. A Simple Example:  <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); </script> </head> <body> <p>If you click on me, I will disappear.</p> </body> </html> 49
  • 50. Downloading jQuery Two versions of jQuery are available for downloading: one minified and one uncompressed (for debugging or reading). Both versions can be downloaded from  http://docs.jquery.com/Downloading_jQuery#Download_jQuery 50
  • 51. Alternatives to Downloading If you don't want to store the jQuery library on your own computer, you can use the hosted jQuery library from Google or Microsoft. Google <head> <script type="text/javascript" src="http://ajax.googleapis.c om/ajax/libs/jquery/1.4.2/jq uery.min.js"></script> </head> 51 Microsoft <head> <script type="text/javascript" src="http://ajax.microsoft.c om/ajax/jquery/jquery1.4.2.min.js"></script> </head>
  • 54. Viva Variety! “If you want to create an animation, effect or UI component, chances are pretty good that someone has done your work for you already.” plugins.jquery.com 54
  • 55. Great References John Resig's introduction slides jQuery 1.4 Cheat Sheet jQuery API jQuery Forums YAYquery Podcast (explicit) http://docs.jquery.com/How_ jQuery_Works DEMOS: jsbin.com/ecayo3/18 55
  • 56. I Like Plugins! Show Us More! 56
  • 57. For any queries mail: girish092.ch@gmail.com 57

Editor's Notes

  1. Jquery is totally awesome. I hate how expensive trainings are. So I wanted to give you all training here today that’s priceless. I really like to learn things at meetings
  2. Open Source JavaScript framework. Jquery was created by John Resig in 2006 and since then has exploded into popularity in the web community.
  3. It uses CSS rules to grab DOM elements that&apos;s why its so easy to use, because we all know how to address com elements with css already. Its really small, it loads really fast in most browsers. The community is great. I had a question once about how to do something for the new homepage. I asked the question before i left work and had a response by my ride home. And its compatible with most major browsers. If you make something that works in FF itll work in IE6 guaranteed.
  4. Swf object is for putting flash on a page, the closest actual pure JavaScript framework is prototype. And don’t forget that jQueryUI, a part of jQuery is included in this list, above even mootools.
  5. You can see this list on their website. Microsoft just announced that they are going to be dedicating coder time and resources to improving jQuery core, and its plugins. This is HUGE. Mention anti microsoft sentiment, and the fact that even microsoft wants IE6 to die.
  6. So I mentioned the DOM before, what exactly is the DOM?
  7. The Document Object Model. The DOM is everything you write in your html documents, images, css, all your tags, everything. The DOM is a mess. There are a million different ways to accomplish things within it and many different doctypes and uppercase and lowercase are allowed attributes that sometimes need quotes, and othertimes don’t. jQuery is coded around all those inconsistencies. jQuery can modifiy the DOM, but it cant do so untill the DOM is ready.
  8. So we wrap all our jQuery code inside some code. Its called the document ready function, and it is only run after all your page has loaded. Shorthand is $(function(){ });
  9. #1 is closer to 99%
  10. Loading from the CDN’s is usually the fastest way, because if you are downloading from one place, you can be downloading from another place at the same time. We usually load it on our servers.
  11. Load at the bottom f the page because when the browser is downloading javascripts it blocks everything else So lets light the fuse now…
  12. So lets see what we’re up against. We begin with a plain P tag and end with a p tag with a class of isCool Lets break it down on the next page DEMO
  13. We check for the DOM to be ready by the $(function() wrapper We use the $ to initialize a jquery function Then we surround a CSS selector with parenthesis and quotes (all P’s will be selected) Then I initiate a jquery method called addClass and tell it what class to add. It&apos;s a good thing to note that I don&apos;t add a . Before isCool when adding removing classes. Most methods are alike in how they are called, be careful to check to api to see how to use each method. I end with a semicolon just like most lines of javascript code And then close the document ready wrapper Double quotes can be swapped with single quotes. Same rules apply as normal html or javascript, if you use one you have to end one before switching to the other.
  14. Here you can see some of the basic css selectors supported by jquery Simple things that you&apos;ve seen a lot before. Div p classes etc In order to not select everything, make sure to be specific with your CSS selector
  15. I want to make this p tag classy, So I’m going to use the addClass method on it and add the sophisticated class to it you see the before and after html Note the lack of . Before the class name, that’s only needed for selection
  16. I remove classes with a different method, but the way in which I do it stays the same. If there were other classes on the p tag they would stay intact DEMO
  17. You can show a div by running the show method. There is a hide method as well. DEMO
  18. Text will change the inner text of a DOM element DEMO.
  19. Methods can be separated across multiple lines. Or kept on the same line This is a best practice for code readability Make sure you end your chain with a semicolon; DEMO
  20. Plenty of examples of basic methods within jQuery.
  21. Questions so far about 15 minutes
  22. Lets get into the meat of jQuery for beginners
  23. Trust me on this
  24. All demos are on JS Bin. It’s a javascript sandbox that allows you to edit my code examples directly.