SlideShare a Scribd company logo
jQuery Framework Mohammed Arif Senior Interactive Developer @  SapientNitro Twitter@ arif_iq Linkedin:  http:// in.linkedin.com/in/mohdarif Blog:  http:// www.mohammedarif.com
Agenda: Why you should use jQuery What is $() What Unobtrusive JavaScript means The jQuery wrapper  The document ready handler Utility functions  Extending jQuery – Plugin Development Using jQuery with other libraries
Before We Start! Self-executed anonymous function // Create a anonymous function, to use as a wrapper ( function () { // The variable that would, normally, be global var   msg =   “It’s a self executed anonymous function!"; alert (   msg   ); // Close off the anonymous function and execute it })();
Why you should use jQuery jQuery  is ideal because it can create impressive animations and interactions (AJAX). jQuery is simple to understand and easy to use, which means the learning curve is small, while the possibilities are infinite. Fast, concise, unobtrusive JavaScript Library  Lightweight footprint Approx 15KB in size (Minified and Gzipped) Cross-browser IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+ CSS3 Compliant Supports CSS 1-3 and basic XPath
What is $() Everything starts with $ It’s a shortcut: $() == jQuery() the $() function removes the need to do a for loop to access a group of elements since whatever we put inside the parentheses will be looped through automatically and stored as a jQuery object. We can put just about anything inside the parentheses of the $() function.
What Unobtrusive JavaScript means <a onclick=&quot;doSomething()&quot; href=&quot;  backuplink.html   &quot;>Click!</a>   <a href=&quot;backuplink.html&quot; class=&quot;doSomething&quot;>Click!</a>   $('a.doSomething').click(function(){        // Do something here!        alert('You did something, woo hoo!');   });   Separation of functionality (the &quot;behavior layer&quot;) from a Web  page's structure/content and presentation.
$(document).ready() $(document).ready() Replacement for window.onload event Executes as soon DOM is ready Doesn’t require external sources to be loaded Images Frames Etc $( function ) = $(document).ready( function )
Utility functions Functions namespaced by $ that don’t operate on a wrapped set. These functions could be thought of as top-level functions except that they are defined on the $ instance rather than window. jQuery flags $.browser $.boxModel $.styleFloat etc. Contains flags for the user agent, read from  navigator.userAgent.
Extending jQuery Fortunately, and by design, jQuery makes it easy to extend its set of functions by extending the wrapper returned when we call $(). jQuery offers a mechanism for adding in methods and functionality, bundled as plugins. Most of the methods and functions included in the default download are written using the jQuery plugin construct. $.fn.methodName = function() { … . } $.methodName = function() { … . }
Important points to remember  Name your file jquery.[insert name of plugin].js, eg. jquery.disable.js  All new methods are attached to the jQuery.fn object, all functions to the jQuery object.  inside methods, 'this' is a reference to the current jQuery object.  Any methods or functions you attach must have a semicolon (;) at the end - otherwise the code will break when compressed.  Your method must return the jQuery object, unless explicitly noted otherwise.  You should use  this.each  to iterate over the current set of matched elements - it produces clean and compatible code that way.  Always use  jQuery  instead of  $  inside your plugin code - that allows users to change the alias for jQuery in a single place.
Using jQuery with other libraries The definition of the $ variable is the largest point of contention and conflict when using other libraries on the same page as jQuery. As we know, jQuery uses $ as an alias for the jQuery name, which is used for every feature that jQuery exhibits. But other libraries, most notably Prototype, use the $ name as well. jQuery provides the $.noConflict() utility function to relinquish control of the $ name to whatever other library might wish to use it. The syntax of this function is as follows:
References http://jquery.com/ http:// docs.jquery.com/Main_Page http://www.visualjquery.com/ http://docs.jquery.com/Plugins/Authoring http://www.learningjquery.com/ http://groups.google.com/group/jquery-en http:// javascriptlibraries.com /
Feedback
Ad

More Related Content

What's hot (20)

ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
ritika1
 
Java script
Java scriptJava script
Java script
Shyam Khant
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
Sehwan Noh
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
Laurence Svekis ✔
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
FAKHRUN NISHA
 
Jquery
JqueryJquery
Jquery
Girish Srivastava
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
Mohammed Arif
 
Angular Lifecycle Hooks
Angular Lifecycle HooksAngular Lifecycle Hooks
Angular Lifecycle Hooks
Squash Apps Pvt Ltd
 
React/Redux
React/ReduxReact/Redux
React/Redux
Durgesh Vaishnav
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
Amit Baghel
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Javascript
JavascriptJavascript
Javascript
mussawir20
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
Jalpesh Vasa
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
jQuery
jQueryjQuery
jQuery
Dileep Mishra
 
jQuery
jQueryjQuery
jQuery
Mostafa Bayomi
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
ritika1
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
Sehwan Noh
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
Laurence Svekis ✔
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
FAKHRUN NISHA
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
Mohammed Arif
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 

Viewers also liked (11)

Présentation jQuery pour débutant
Présentation jQuery pour débutantPrésentation jQuery pour débutant
Présentation jQuery pour débutant
Stanislas Chollet
 
JQuery
JQueryJQuery
JQuery
Zakaria SMAHI
 
Jquery - introduction au langage
Jquery - introduction au langageJquery - introduction au langage
Jquery - introduction au langage
StrasWeb
 
jQuery
jQueryjQuery
jQuery
Jay Poojara
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
Marc Grabanski
 
jQuery Best Practice
jQuery Best Practice jQuery Best Practice
jQuery Best Practice
chandrashekher786
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
Dominic Arrojado
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Aperçu de java EE 5
Aperçu de java EE 5Aperçu de java EE 5
Aperçu de java EE 5
Quentin Adam
 
Ccna support v2.5
Ccna support v2.5Ccna support v2.5
Ccna support v2.5
Mbaye Dieye
 
Introduction a jQuery
Introduction a jQueryIntroduction a jQuery
Introduction a jQuery
Clément Delmas
 
Ad

Similar to jQuery (20)

jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
BlackCatWeb
 
J Query
J QueryJ Query
J Query
ravinxg
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query Presentation
Vishal Kumar
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
Laurence Svekis ✔
 
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
Eugene Andruszczenko
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
William Myers
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
Anil Kumar
 
jQuery Interview Questions By ScholarHat.pdf
jQuery Interview Questions By ScholarHat.pdfjQuery Interview Questions By ScholarHat.pdf
jQuery Interview Questions By ScholarHat.pdf
Scholarhat
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
Doncho Minkov
 
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontojQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
Ralph Whitbeck
 
Think jQuery
Think jQueryThink jQuery
Think jQuery
Ying Zhang
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
iFour Institute - Sustainable Learning
 
jQuery
jQueryjQuery
jQuery
Vishwa Mohan
 
Jquery
Jquery Jquery
Jquery
eginni
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Nagaraju Sangam
 
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwapptJquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
shubhangimalas1
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
Cognizant
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
BlackCatWeb
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query Presentation
Vishal Kumar
 
Web Development Introduction to jQuery
Web Development Introduction to jQueryWeb Development Introduction to jQuery
Web Development Introduction to jQuery
Laurence Svekis ✔
 
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
 
jQuery Presentation - Refresh Events
jQuery Presentation - Refresh EventsjQuery Presentation - Refresh Events
jQuery Presentation - Refresh Events
Eugene Andruszczenko
 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Refresh Events
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
Anil Kumar
 
jQuery Interview Questions By ScholarHat.pdf
jQuery Interview Questions By ScholarHat.pdfjQuery Interview Questions By ScholarHat.pdf
jQuery Interview Questions By ScholarHat.pdf
Scholarhat
 
jQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days TorontojQuery For Developers Stack Overflow Dev Days Toronto
jQuery For Developers Stack Overflow Dev Days Toronto
Ralph Whitbeck
 
Jquery
Jquery Jquery
Jquery
eginni
 
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwapptJquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
Jquery PPT_Finalfgfgdfgdr5tryeujkhdwappt
shubhangimalas1
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
Cognizant
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
Hoat Le
 
Ad

Recently uploaded (20)

Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Alan Dix
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Gary Arora
 
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
UXPA Boston
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
DNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in NepalDNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in Nepal
ICT Frame Magazine Pvt. Ltd.
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Who's choice? Making decisions with and about Artificial Intelligence, Keele ...
Alan Dix
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Gary Arora
 
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
UXPA Boston
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 

jQuery

  • 1. jQuery Framework Mohammed Arif Senior Interactive Developer @ SapientNitro Twitter@ arif_iq Linkedin: http:// in.linkedin.com/in/mohdarif Blog: http:// www.mohammedarif.com
  • 2. Agenda: Why you should use jQuery What is $() What Unobtrusive JavaScript means The jQuery wrapper The document ready handler Utility functions Extending jQuery – Plugin Development Using jQuery with other libraries
  • 3. Before We Start! Self-executed anonymous function // Create a anonymous function, to use as a wrapper ( function () { // The variable that would, normally, be global var msg = “It’s a self executed anonymous function!&quot;; alert ( msg ); // Close off the anonymous function and execute it })();
  • 4. Why you should use jQuery jQuery is ideal because it can create impressive animations and interactions (AJAX). jQuery is simple to understand and easy to use, which means the learning curve is small, while the possibilities are infinite. Fast, concise, unobtrusive JavaScript Library Lightweight footprint Approx 15KB in size (Minified and Gzipped) Cross-browser IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+ CSS3 Compliant Supports CSS 1-3 and basic XPath
  • 5. What is $() Everything starts with $ It’s a shortcut: $() == jQuery() the $() function removes the need to do a for loop to access a group of elements since whatever we put inside the parentheses will be looped through automatically and stored as a jQuery object. We can put just about anything inside the parentheses of the $() function.
  • 6. What Unobtrusive JavaScript means <a onclick=&quot;doSomething()&quot; href=&quot; backuplink.html &quot;>Click!</a>   <a href=&quot;backuplink.html&quot; class=&quot;doSomething&quot;>Click!</a>  $('a.doSomething').click(function(){        // Do something here!        alert('You did something, woo hoo!');   });  Separation of functionality (the &quot;behavior layer&quot;) from a Web page's structure/content and presentation.
  • 7. $(document).ready() $(document).ready() Replacement for window.onload event Executes as soon DOM is ready Doesn’t require external sources to be loaded Images Frames Etc $( function ) = $(document).ready( function )
  • 8. Utility functions Functions namespaced by $ that don’t operate on a wrapped set. These functions could be thought of as top-level functions except that they are defined on the $ instance rather than window. jQuery flags $.browser $.boxModel $.styleFloat etc. Contains flags for the user agent, read from navigator.userAgent.
  • 9. Extending jQuery Fortunately, and by design, jQuery makes it easy to extend its set of functions by extending the wrapper returned when we call $(). jQuery offers a mechanism for adding in methods and functionality, bundled as plugins. Most of the methods and functions included in the default download are written using the jQuery plugin construct. $.fn.methodName = function() { … . } $.methodName = function() { … . }
  • 10. Important points to remember Name your file jquery.[insert name of plugin].js, eg. jquery.disable.js All new methods are attached to the jQuery.fn object, all functions to the jQuery object. inside methods, 'this' is a reference to the current jQuery object. Any methods or functions you attach must have a semicolon (;) at the end - otherwise the code will break when compressed. Your method must return the jQuery object, unless explicitly noted otherwise. You should use this.each to iterate over the current set of matched elements - it produces clean and compatible code that way. Always use jQuery instead of $ inside your plugin code - that allows users to change the alias for jQuery in a single place.
  • 11. Using jQuery with other libraries The definition of the $ variable is the largest point of contention and conflict when using other libraries on the same page as jQuery. As we know, jQuery uses $ as an alias for the jQuery name, which is used for every feature that jQuery exhibits. But other libraries, most notably Prototype, use the $ name as well. jQuery provides the $.noConflict() utility function to relinquish control of the $ name to whatever other library might wish to use it. The syntax of this function is as follows:
  • 12. References http://jquery.com/ http:// docs.jquery.com/Main_Page http://www.visualjquery.com/ http://docs.jquery.com/Plugins/Authoring http://www.learningjquery.com/ http://groups.google.com/group/jquery-en http:// javascriptlibraries.com /