SlideShare a Scribd company logo
2
Most read
3
Most read
8
Most read
JQUERY
Prepared By

Jay Poojara

1
WHAT IS JQUERY?
jQuery is a fast, small, and feature-rich JavaScript library. It
makes things like HTML document traversal and manipulation, event
handling, animation, and Ajax much simpler with an easy-to-use API
that works across a multitude of browsers. With a combination of
versatility and extensibility, jQuery has changed the way that millions of
people write JavaScript.

2
WHY IS JQUERY AWESOME?
What jQuery does well:
1.
2.
3.
4.
5.

Simplified AJAX
DOM Manipulation
Event Management
Animations
Normalizes Browser Differences

Why It Is Successful:
1.
2.
3.
4.
5.

Well Designed
Easy to extend with plugins
Great Documentation
Large jQuery Community
Cross-browser

3
JQUERY FOUNDER

4
WHO'S USING JQUERY?

….This are some of the examples….

5
JQUERY PHILOSOPHY
Find some stuff

Do something to it

6
SAMPLE JQUERY
Our DOM
Include jQuery
The „ready event‟ – Binds a function to
be executed whenever the DOM is
ready
Select the „toggleContent‟ DOM
element and bind a click event
handler to it.
Select the „content‟ DOM element and
set the text to „Hello World!‟
Prevent the default behavior of the
anchor tag by returning false
7
DOLLAR FUNCTION $();
• JavaScript identifiers can start with $
• The jQuery framework automatically assigns „$‟ to the „jQuery‟
function
$ === jQuery true
$(selector) is same as jQuery(selector)

• Can use utility function to unassign $
$.noConflict();
$ === jQuery;

false

• Can reassign jQuery to another variable
$j = $.noConflict();

$j === jQuery;

true

$j === $;

false
8

$ === jQuery;

false
DOCUMENT READY EVENT
• $(document).ready(fn);
• The bound function will be called the instant the
DOM is ready to be read and manipulated.
• As many as you want on the page.
• Executed in the order they were added.

• There is a shortcut: $(fn);

9
SELECTORS
CSS3 Selectors
jQuery

Selects…

$(„#myId‟)

By ID

$(„div‟)

By Element Type

$(„.myClass‟)

By Class

$(„div, span, p.myClass, #myid‟)

Multiple

$(„*‟)

All

$(„.myClass‟, this), $(„p.myClass‟)

By Context (better performance)

$(„#main div‟)

Descendents (all levels)

$(„#main > div‟)

Children (first level)

$(„label + input‟)

The immediate element after

$(„#prev ~ div‟)

The first element after

$(„div[id]‟)

All elements that have the specified attribute

$(„input[type=text]‟)

By Attribute value
10
FILTERS
$(„div:empty‟), $(„:empty‟), $(„div:not(:empty)‟)
jQuery

Filters…

:first, :last, :nth(n)

First, Last, Nth Element

:odd, :even

Odd, Even Elements

:visible, :hidden

Visible, Hidden Elements

:enabled, :disabled

Enabled, Disabled Elements

:contains(“text”)

Contains specified text

:empty

Elements w/ no children (or text)

:first-child, :last-child, :nthchild(n)

Child Element

:lt(n), :gt(n)

Elements w/ index below or after

:not(selector)

Does not match selector

:MyCustomFilter

Custom Filters (Implement your own!)

Custom Filter Used

11
CHAINING
• Most jQuery methods return another jQuery object (usually the same
collection), which means you can chain method calls together with a
fluent like syntax
• Some methods that stop a chain, these methods return a value from the
jQuery object
.css(name), .text(), .html(), .val(), .height(), .width(), .is(„:visible‟)

• Some methods will return a different jQuery collection, you can revert
to the previous collection by calling .end();

12
ATTRIBUTES & CLASSES
• Getters & Setters for attr, html, text, val
• Getter (returns String – breaks chain)
var text = $(„#myDiv‟).text();

• Setter (returns jQuery)
$(„#myDiv‟).text(„Hello World!‟);

• text() escapes html()
• val() used with inputs

• attr() can take JSON

• Add, Remove for Attributes & Classes
• .removeAttr(„someAttr‟);
• .addClass(„someClass‟);

• .removeClass(„someClass‟);
• .toggleClass(„someClass‟);
13
TRAVERSING
• Family
• parent, parents, siblings, children

• Proximity
• closest, next, prev, nextAll, prevAll

• Searching
• find

14
EVENTS
.bind(type, data, fn)
• Binds a handler to an event on all matched elements

.one(type, data, fn)
• Binds a handler to be executed only once for each matched element

.trigger(event, data)
• Trigger an event to occur on all matched elements

.unbind(type, fn)
• Removes event handlers from all matched elements

.live(type, fn)
• Binds a handler to an event on all currently matched and future matched elements.

.die(type, fn)
• Removes a bound live event.

.hover(fnOver, fnOut)
• Interaction helper that will handle mouseover and mouseout

.toggle(fn1, fn2, fn3, fnN, …)
• Interaction helper that will toggle among two or more function calls every other click.

15
EVENT HELPERS
blur, change, click, dblclick, error, focus, keydown, keypress, k
eyup, load, mousedown, mouseenter, mouseleave, mousemov
e, mouseup, resize, scroll, select, submit, unload

16
MANIPULATION
• Inserting Inside
•

append, prepend

•

appendTo, prependTo

• Inserting Outside
•

after, before

•

insertAfter, insertBefore

• Inserting Around
•

wrapInner

•

wrap

•

wrapAll

• Replacing
•

replaceWith, replaceAll

• Removing
•

empty, remove

• Copying
•

clone
17
EFFECTS
• Basics
• show, hide, toggle

• Sliding
• slideUp, slideDown, slideToggle

• Fading
• fadeIn, fadeOut, fadeTo (opacity 0-1)

• Custom
• animate, stop

18
PLUG-INS
• Extremely Simple – Promotes code reuse and DRY principle
$.fn.MyPlugin = function(params) {};

• Return a jQuery object to prevent from “breaking the chain”
• Unless you are returning a specific value

• Best Practice is to wrap the plug-in declaration within an anonymous
JavaScript function in order to prevent collisions with the use of $

19
UTILITY FUNCTIONS
• Array and Object Operations
$.each(object, callback) – Callback function will run for each item in the object. The each method
is meant to be an immutable iterator and returns the original array.
$.map(array, callback) – Callback function will run for each item in the array. The map method
can be used as an iterator, but is designed to be used for manipulation of the supplied array
and returns a new array.
$.merge(first, second) – Merges the second array into the first array.
$.unique(array) – Removes duplicate elements (only works on arrays of DOM elements).
$.extend(object) – Add functions into the jQuery namespace.
$.extend(deep, target, object1, objectN) – Merge values from objects 1 to N into target object.
Deep is an optional boolean that if true, tells jQuery to do a deep copy.
$.grep(array, callback, invert) – Iterates through array, and returns a new array with values from
the original array that satisfy the criteria specified in the callback.
$.inArray(value, array) – Gets the index of the value in the array (-1 if not found).

• String Operations
$.trim(str) – Removes whitespace from the given string.

• Test Operations
$.isArray(obj) – Determines if the object is an array.
$.isFunction(obj) – Determines if the object is a function.

20
JQUERY DATA
• Can store data on one or more jQuery elements
• .data(name, value)

• value is an object

• Retrieves data from the first element in the jQuery object
• .data(name)

21
RESOURCES
• jQuery Main
•

http://jquery.com

•

http://docs.jquery.com/Downloading_jQuery

• jQuery API Documentation
•

http://api.jquery.com

•

http://docs.jquery.com

• jQuery UI
•

http://jqueryui.com

•

http://jqueryui.com/themeroller/

• jQuery Blog
•

http://blog.jquery.com/

• Around The Web
•

•

http://www.nettuts.com

•

•

http://stackoverflow.com

http://www.smashingmagazine.com

Tools
•

Visual Studio JavaScript Intellisense Support (KB958502)

•

http://getfirebug.com/ (Firebug Firefox Plug-in)

•

http://jsbin.com/ (JS Bin - Collaborative JavaScript Debugging)

22
THANK YOU
Even a correct decision is wrong when it was taken too
late.

any Queries?

23

More Related Content

What's hot (20)

PPTX
React workshop
Imran Sayed
 
PPTX
Introduction to React JS
Arnold Asllani
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PPTX
reactJS
Syam Santhosh
 
PDF
jQuery for beginners
Arulmurugan Rajaraman
 
PPT
Java collections concept
kumar gaurav
 
PDF
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
Edureka!
 
PPTX
[Final] ReactJS presentation
洪 鹏发
 
PPT
jQuery
Mostafa Bayomi
 
PPT
JavaScript & Dom Manipulation
Mohammed Arif
 
PDF
The New JavaScript: ES6
Rob Eisenberg
 
PDF
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
PPTX
Angular overview
Thanvilahari
 
PPT
Js ppt
Rakhi Thota
 
PPTX
Introduction to spring boot
Santosh Kumar Kar
 
PDF
javascript objects
Vijay Kalyan
 
PDF
Nodejs presentation
Arvind Devaraj
 
React workshop
Imran Sayed
 
Introduction to React JS
Arnold Asllani
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
reactJS
Syam Santhosh
 
jQuery for beginners
Arulmurugan Rajaraman
 
Java collections concept
kumar gaurav
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
Edureka!
 
[Final] ReactJS presentation
洪 鹏发
 
JavaScript & Dom Manipulation
Mohammed Arif
 
The New JavaScript: ES6
Rob Eisenberg
 
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Angular overview
Thanvilahari
 
Js ppt
Rakhi Thota
 
Introduction to spring boot
Santosh Kumar Kar
 
javascript objects
Vijay Kalyan
 
Nodejs presentation
Arvind Devaraj
 

Viewers also liked (20)

PDF
jQuery Essentials
Marc Grabanski
 
PPTX
jQuery Presentation
Rod Johnson
 
PPT
jQuery
Mohammed Arif
 
PDF
Learning jQuery in 30 minutes
Simon Willison
 
PPTX
Leap motion
Jay Poojara
 
ODP
Jquery- One slide completing all JQuery
Knoldus Inc.
 
PPT
Présentation jQuery pour débutant
Stanislas Chollet
 
PDF
Jquery - introduction au langage
StrasWeb
 
PDF
JQuery
Zakaria SMAHI
 
PDF
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Simon Willison
 
PPTX
Communication skill ii
Rudra Bhatt
 
PDF
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
PDF
Introduction To Javascript
Rajat Pandit
 
PDF
Introduction to JavaScript
Jussi Pohjolainen
 
PPTX
Hololens
vipin sharma
 
PPTX
JavaScript and jQuery Basics
Kaloyan Kosev
 
PPTX
Bootstrap PPT by Mukesh
Mukesh Kumar
 
PPTX
Leap motion
vipin sharma
 
PPTX
Bootstrap ppt
Nidhi mishra
 
PPTX
jQuery from the very beginning
Anis Ahmad
 
jQuery Essentials
Marc Grabanski
 
jQuery Presentation
Rod Johnson
 
Learning jQuery in 30 minutes
Simon Willison
 
Leap motion
Jay Poojara
 
Jquery- One slide completing all JQuery
Knoldus Inc.
 
Présentation jQuery pour débutant
Stanislas Chollet
 
Jquery - introduction au langage
StrasWeb
 
Jazz up your JavaScript: Unobtrusive scripting with JavaScript libraries
Simon Willison
 
Communication skill ii
Rudra Bhatt
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
Introduction To Javascript
Rajat Pandit
 
Introduction to JavaScript
Jussi Pohjolainen
 
Hololens
vipin sharma
 
JavaScript and jQuery Basics
Kaloyan Kosev
 
Bootstrap PPT by Mukesh
Mukesh Kumar
 
Leap motion
vipin sharma
 
Bootstrap ppt
Nidhi mishra
 
jQuery from the very beginning
Anis Ahmad
 
Ad

Similar to jQuery (20)

PPTX
jQuery
Jon Erickson
 
PDF
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
PPTX
jQuery basics for Beginners
Pooja Saxena
 
PPTX
Introduction to Jquery
Ahmed Elharouny
 
PPT
J query presentation
sawarkar17
 
PPT
J query presentation
akanksha17
 
PPTX
Web technologies-course 11.pptx
Stefan Oprea
 
PDF
The Dom Scripting Toolkit J Query
QConLondon2008
 
PPTX
Web Development Introduction to jQuery
Laurence Svekis ✔
 
PDF
J query fundamentals
Attaporn Ninsuwan
 
PPTX
A to Z about JQuery - Become Newbie to Expert Java Developer
Manoj Bhuva
 
PDF
DOM Scripting Toolkit - jQuery
Remy Sharp
 
PDF
jQuery
Ivano Malavolta
 
PDF
Jquery In Action Second Edition 2nd Ed Bear Bibeault Yehuda Katz
aneilvoyce0a
 
PPTX
A Rich Web experience with jQuery, Ajax and .NET
James Johnson
 
PDF
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
PDF
Learning jquery-in-30-minutes-1195942580702664-3
luckysb16
 
PPTX
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
PDF
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
RAVALCHIRAG1
 
PPT
Jquery presentation
Narendra Dabhi
 
jQuery
Jon Erickson
 
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
jQuery basics for Beginners
Pooja Saxena
 
Introduction to Jquery
Ahmed Elharouny
 
J query presentation
sawarkar17
 
J query presentation
akanksha17
 
Web technologies-course 11.pptx
Stefan Oprea
 
The Dom Scripting Toolkit J Query
QConLondon2008
 
Web Development Introduction to jQuery
Laurence Svekis ✔
 
J query fundamentals
Attaporn Ninsuwan
 
A to Z about JQuery - Become Newbie to Expert Java Developer
Manoj Bhuva
 
DOM Scripting Toolkit - jQuery
Remy Sharp
 
Jquery In Action Second Edition 2nd Ed Bear Bibeault Yehuda Katz
aneilvoyce0a
 
A Rich Web experience with jQuery, Ajax and .NET
James Johnson
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Sean Burgess
 
Learning jquery-in-30-minutes-1195942580702664-3
luckysb16
 
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
RAVALCHIRAG1
 
Jquery presentation
Narendra Dabhi
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 

jQuery

  • 2. WHAT IS JQUERY? jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript. 2
  • 3. WHY IS JQUERY AWESOME? What jQuery does well: 1. 2. 3. 4. 5. Simplified AJAX DOM Manipulation Event Management Animations Normalizes Browser Differences Why It Is Successful: 1. 2. 3. 4. 5. Well Designed Easy to extend with plugins Great Documentation Large jQuery Community Cross-browser 3
  • 5. WHO'S USING JQUERY? ….This are some of the examples…. 5
  • 6. JQUERY PHILOSOPHY Find some stuff Do something to it 6
  • 7. SAMPLE JQUERY Our DOM Include jQuery The „ready event‟ – Binds a function to be executed whenever the DOM is ready Select the „toggleContent‟ DOM element and bind a click event handler to it. Select the „content‟ DOM element and set the text to „Hello World!‟ Prevent the default behavior of the anchor tag by returning false 7
  • 8. DOLLAR FUNCTION $(); • JavaScript identifiers can start with $ • The jQuery framework automatically assigns „$‟ to the „jQuery‟ function $ === jQuery true $(selector) is same as jQuery(selector) • Can use utility function to unassign $ $.noConflict(); $ === jQuery; false • Can reassign jQuery to another variable $j = $.noConflict(); $j === jQuery; true $j === $; false 8 $ === jQuery; false
  • 9. DOCUMENT READY EVENT • $(document).ready(fn); • The bound function will be called the instant the DOM is ready to be read and manipulated. • As many as you want on the page. • Executed in the order they were added. • There is a shortcut: $(fn); 9
  • 10. SELECTORS CSS3 Selectors jQuery Selects… $(„#myId‟) By ID $(„div‟) By Element Type $(„.myClass‟) By Class $(„div, span, p.myClass, #myid‟) Multiple $(„*‟) All $(„.myClass‟, this), $(„p.myClass‟) By Context (better performance) $(„#main div‟) Descendents (all levels) $(„#main > div‟) Children (first level) $(„label + input‟) The immediate element after $(„#prev ~ div‟) The first element after $(„div[id]‟) All elements that have the specified attribute $(„input[type=text]‟) By Attribute value 10
  • 11. FILTERS $(„div:empty‟), $(„:empty‟), $(„div:not(:empty)‟) jQuery Filters… :first, :last, :nth(n) First, Last, Nth Element :odd, :even Odd, Even Elements :visible, :hidden Visible, Hidden Elements :enabled, :disabled Enabled, Disabled Elements :contains(“text”) Contains specified text :empty Elements w/ no children (or text) :first-child, :last-child, :nthchild(n) Child Element :lt(n), :gt(n) Elements w/ index below or after :not(selector) Does not match selector :MyCustomFilter Custom Filters (Implement your own!) Custom Filter Used 11
  • 12. CHAINING • Most jQuery methods return another jQuery object (usually the same collection), which means you can chain method calls together with a fluent like syntax • Some methods that stop a chain, these methods return a value from the jQuery object .css(name), .text(), .html(), .val(), .height(), .width(), .is(„:visible‟) • Some methods will return a different jQuery collection, you can revert to the previous collection by calling .end(); 12
  • 13. ATTRIBUTES & CLASSES • Getters & Setters for attr, html, text, val • Getter (returns String – breaks chain) var text = $(„#myDiv‟).text(); • Setter (returns jQuery) $(„#myDiv‟).text(„Hello World!‟); • text() escapes html() • val() used with inputs • attr() can take JSON • Add, Remove for Attributes & Classes • .removeAttr(„someAttr‟); • .addClass(„someClass‟); • .removeClass(„someClass‟); • .toggleClass(„someClass‟); 13
  • 14. TRAVERSING • Family • parent, parents, siblings, children • Proximity • closest, next, prev, nextAll, prevAll • Searching • find 14
  • 15. EVENTS .bind(type, data, fn) • Binds a handler to an event on all matched elements .one(type, data, fn) • Binds a handler to be executed only once for each matched element .trigger(event, data) • Trigger an event to occur on all matched elements .unbind(type, fn) • Removes event handlers from all matched elements .live(type, fn) • Binds a handler to an event on all currently matched and future matched elements. .die(type, fn) • Removes a bound live event. .hover(fnOver, fnOut) • Interaction helper that will handle mouseover and mouseout .toggle(fn1, fn2, fn3, fnN, …) • Interaction helper that will toggle among two or more function calls every other click. 15
  • 16. EVENT HELPERS blur, change, click, dblclick, error, focus, keydown, keypress, k eyup, load, mousedown, mouseenter, mouseleave, mousemov e, mouseup, resize, scroll, select, submit, unload 16
  • 17. MANIPULATION • Inserting Inside • append, prepend • appendTo, prependTo • Inserting Outside • after, before • insertAfter, insertBefore • Inserting Around • wrapInner • wrap • wrapAll • Replacing • replaceWith, replaceAll • Removing • empty, remove • Copying • clone 17
  • 18. EFFECTS • Basics • show, hide, toggle • Sliding • slideUp, slideDown, slideToggle • Fading • fadeIn, fadeOut, fadeTo (opacity 0-1) • Custom • animate, stop 18
  • 19. PLUG-INS • Extremely Simple – Promotes code reuse and DRY principle $.fn.MyPlugin = function(params) {}; • Return a jQuery object to prevent from “breaking the chain” • Unless you are returning a specific value • Best Practice is to wrap the plug-in declaration within an anonymous JavaScript function in order to prevent collisions with the use of $ 19
  • 20. UTILITY FUNCTIONS • Array and Object Operations $.each(object, callback) – Callback function will run for each item in the object. The each method is meant to be an immutable iterator and returns the original array. $.map(array, callback) – Callback function will run for each item in the array. The map method can be used as an iterator, but is designed to be used for manipulation of the supplied array and returns a new array. $.merge(first, second) – Merges the second array into the first array. $.unique(array) – Removes duplicate elements (only works on arrays of DOM elements). $.extend(object) – Add functions into the jQuery namespace. $.extend(deep, target, object1, objectN) – Merge values from objects 1 to N into target object. Deep is an optional boolean that if true, tells jQuery to do a deep copy. $.grep(array, callback, invert) – Iterates through array, and returns a new array with values from the original array that satisfy the criteria specified in the callback. $.inArray(value, array) – Gets the index of the value in the array (-1 if not found). • String Operations $.trim(str) – Removes whitespace from the given string. • Test Operations $.isArray(obj) – Determines if the object is an array. $.isFunction(obj) – Determines if the object is a function. 20
  • 21. JQUERY DATA • Can store data on one or more jQuery elements • .data(name, value) • value is an object • Retrieves data from the first element in the jQuery object • .data(name) 21
  • 22. RESOURCES • jQuery Main • http://jquery.com • http://docs.jquery.com/Downloading_jQuery • jQuery API Documentation • http://api.jquery.com • http://docs.jquery.com • jQuery UI • http://jqueryui.com • http://jqueryui.com/themeroller/ • jQuery Blog • http://blog.jquery.com/ • Around The Web • • http://www.nettuts.com • • http://stackoverflow.com http://www.smashingmagazine.com Tools • Visual Studio JavaScript Intellisense Support (KB958502) • http://getfirebug.com/ (Firebug Firefox Plug-in) • http://jsbin.com/ (JS Bin - Collaborative JavaScript Debugging) 22
  • 23. THANK YOU Even a correct decision is wrong when it was taken too late. any Queries? 23

Editor's Notes