SlideShare a Scribd company logo
3
Most read
9
Most read
11
Most read
www.webstackacademy.com
Introduction
jQuery
www.webstackacademy.comwww.webstackacademy.com
Introduction to jQuery
(Write less, Do more)
www.webstackacademy.com
What is a jQuery?
• jQuery (https://jquery.com/) is a lightweight, feature rich JavaScript library
• jQuery provides easy-to-use APIs to achieve the following:
o Manipulate HTML, CSS and DOM
o Handling HTML events
o Applying effects and animations
o AJAX
o Utilities
• This is one of the most popularly used OpenSource libraries
• Developers can do more with lesser number of lines of code, compared with vanilla JavaScript
www.webstackacademy.com
jQuery is very popular
• Most popular and extendable library for websites and mobile single page app development
• As of June 2018, jQuery is used on 73% of the top 1 million websites, and by 22.4% of overall
number of websites
• Most of the big companies (ex: Google) use jQuery library and host jQuery CDN (Both Google
and Microsoft)
• jQuery simplifies the syntax for finding, selecting, and manipulating DOM elements
• Supported by all modern browsers
www.webstackacademy.com
History of jQuery
• Originally created in Jan 2006 at a BarCamp by John
Resig (who became very popular for his work in
jQuery)
• Official major releases were made in the following
time-lines:
o 1.0 - Aug 2006
o 2.0 - Jan 2014
o 3.0 - Jun 2016
o 3.3.1 - Jan 2018 (which we will be using!)
• The jQuery team also developed jQuery mobile (for
mobile / touch devices) and jQuery UI (for developing
GUI) which has also become popular
www.webstackacademy.com
jQuery CDN
• Both Google and Microsoft host jQuery, links are provided below
Google CDN :
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
Microsoft CDN :
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js">
</script>
• For our learning, you can either use CDN or include a local copy of jQuery library
• Local downloaded copy is available at Google Drive
www.webstackacademy.com
jQuery Development Principles
• P1: Separation of HTML and JS
o jQuery library provides simple syntax for handling DOMs (Ex: Events)
o Hence, developers can avoid adding HTML event attributes to call JavaScript functions
o By this way JavaScript code can be completely separated code from HTML
• P2: Elimination of cross-browser incompatibilities
o The JavaScript engines of different browsers differ from each other
o Therefore, JavaScript code that works for one browser may not work for another
o jQuery handles all these cross-browser inconsistencies and provides a consistent interface
that works across different browsers
• P3: Extensibility
o New events, elements, and methods can be easily added and then reused as a plugin
www.webstackacademy.comwww.webstackacademy.com
jQuery syntax
(Getting hands-on)
www.webstackacademy.com
jQuery syntax
• The jQuery syntax is tailored to select HTML elements and performing some action on them
• Actions can be of varied in nature (ex: DOM manipulation, events etc..) which we will learn in
subsequent chapters
Syntax : $(selector).action()
Selector : this | id | class | element
$(this).action(); // Take action on current element
$(“div”).action(); // Take action on all divisions
$(“.abc”).action(); // Take action on all abc class
www.webstackacademy.com
jQuery syntax
• The $ used is actually a jQuery function
<script src="../jquery/jquery-3.3.1.min.js"
type="text/javascript"></script>
<script>
/* If you remove jQuery inclusion above, you will get undefined here */
document.write("Type of $ = " + typeof $);
if($ == jQuery) {
document.write("<br>$ Function is referencing to jQuery ");
}
</script>
www.webstackacademy.com
jQuery ready event
• Before accessing any element with jQuery, the DOM tree should be completely created
• There could be following possible failures if document is not fully loaded
o Finding an element that is not created
o Hiding an element that is not created
• jQuery detects the state of readiness of document then perform actions
<script>
$(document).ready(function() {
document.write("Welcome to jQuery...");
document.write("DOM is created...");
});
</script>
www.webstackacademy.com
jQuery load event
• Sometimes you may want the entire window to be loaded
• Hence use the "load" method
<script>
$(window).on("load", function() {
document.write("Window loaded!!")
});
</script>
www.webstackacademy.com
jQuery passing named functions
• U can also pass named functions to jQuery as follows
<script>
$(document).ready( myFunc );
// Calling your named function
function myFunc() {
console.log("DOM loaded");
}
</script>
www.webstackacademy.com
jQuery no-conflict mode
• By default, jQuery uses $ as a shortcut for jQuery
• Thus, if you are using another JavaScript library that uses the $ variable, you can run into
conflicts with jQuery
• In order to avoid these conflicts, you need to put jQuery in no-conflict mode immediately after
it is loaded onto the page and before you attempt to use jQuery in your page
www.webstackacademy.com
jQuery no-conflict mode
<script>
/* Creating alias for jQuery function */
jQuery.noConflict();
jQuery(document).ready(function( $ ) {
/* You can use the locally-scoped $ here */
$( "#hidden-para" ).hide();
console.log("jQuery in no-conflict mode");
});
/* You can call other 3rd party library functions here
* $(document).thirdPartyFunc();
* The $ above is 3rd party function reference.
*/
</script>
www.webstackacademy.com
WebStack Academy
#83, Farah Towers,
1st Floor, MG Road,
Bangalore – 560001
M: +91-809 555 7332
E: training@webstackacademy.com
WSA in Social Media:

More Related Content

PPTX
Angularjs PPT
Amit Baghel
 
PDF
Basics of JavaScript
Bala Narayanan
 
PDF
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
PPSX
Javascript variables and datatypes
Varun C M
 
PPT
JavaScript & Dom Manipulation
Mohammed Arif
 
PDF
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
Angularjs PPT
Amit Baghel
 
Basics of JavaScript
Bala Narayanan
 
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Javascript variables and datatypes
Varun C M
 
JavaScript & Dom Manipulation
Mohammed Arif
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 

What's hot (20)

PPTX
Css position
Webtech Learning
 
PPT
JavaScript: Events Handling
Yuriy Bezgachnyuk
 
PPTX
Java Server Pages(jsp)
Manisha Keim
 
PDF
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
PPT
Javascript
Manav Prasad
 
PPTX
Java script
Abhishek Kesharwani
 
PPTX
Angular 9
Raja Vishnu
 
PPT
Angular 8
Sunil OS
 
PPT
Javascript arrays
Hassan Dar
 
PPTX
jQuery
Dileep Mishra
 
PDF
JavaScript - Chapter 11 - Events
WebStackAcademy
 
PPTX
Java Server Pages
Kasun Madusanke
 
PPT
JavaScript - An Introduction
Manvendra Singh
 
PDF
Intro to HTML and CSS basics
Eliran Eliassy
 
PDF
Introduction to back-end
Mosaab Ehab
 
PPTX
jQuery
Jay Poojara
 
PPTX
Introduction to angular with a simple but complete project
Jadson Santos
 
PDF
jQuery for beginners
Arulmurugan Rajaraman
 
Css position
Webtech Learning
 
JavaScript: Events Handling
Yuriy Bezgachnyuk
 
Java Server Pages(jsp)
Manisha Keim
 
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
Javascript
Manav Prasad
 
Java script
Abhishek Kesharwani
 
Angular 9
Raja Vishnu
 
Angular 8
Sunil OS
 
Javascript arrays
Hassan Dar
 
JavaScript - Chapter 11 - Events
WebStackAcademy
 
Java Server Pages
Kasun Madusanke
 
JavaScript - An Introduction
Manvendra Singh
 
Intro to HTML and CSS basics
Eliran Eliassy
 
Introduction to back-end
Mosaab Ehab
 
jQuery
Jay Poojara
 
Introduction to angular with a simple but complete project
Jadson Santos
 
jQuery for beginners
Arulmurugan Rajaraman
 
Ad

Similar to jQuery - Chapter 1 - Introduction (20)

PDF
jQuery
Ivano Malavolta
 
PDF
Jquery presentation
Mevin Mohan
 
PDF
Jquery tutorial-beginners
Isfand yar Khan
 
PDF
Introduction to jQuery
Nagaraju Sangam
 
PPTX
J query
Ramakrishna kapa
 
KEY
Everything You Need to Know in Order to Start Using jQuery
Dave Ross
 
PPTX
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
PPT
JavaScript Libraries
Daminda Herath
 
PPTX
Getting started with jQuery
Gill Cleeren
 
PPTX
Getting Started with jQuery
Laila Buncab
 
PPT
J query presentation
sawarkar17
 
PPT
J query presentation
akanksha17
 
PDF
J query fundamentals
Attaporn Ninsuwan
 
PPTX
jQuery
Vishwa Mohan
 
PDF
Introduction to jQuery
Seble Nigussie
 
PDF
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
Jquery presentation
Mevin Mohan
 
Jquery tutorial-beginners
Isfand yar Khan
 
Introduction to jQuery
Nagaraju Sangam
 
Everything You Need to Know in Order to Start Using jQuery
Dave Ross
 
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
JavaScript Libraries
Daminda Herath
 
Getting started with jQuery
Gill Cleeren
 
Getting Started with jQuery
Laila Buncab
 
J query presentation
sawarkar17
 
J query presentation
akanksha17
 
J query fundamentals
Attaporn Ninsuwan
 
jQuery
Vishwa Mohan
 
Introduction to jQuery
Seble Nigussie
 
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
Ad

More from WebStackAcademy (20)

PDF
Webstack Academy - Course Demo Webinar and Placement Journey
WebStackAcademy
 
PDF
WSA: Scaling Web Service to Handle Millions of Requests per Second
WebStackAcademy
 
PDF
WSA: Course Demo Webinar - Full Stack Developer Course
WebStackAcademy
 
PDF
Career Building in AI - Technologies, Trends and Opportunities
WebStackAcademy
 
PDF
Webstack Academy - Internship Kick Off
WebStackAcademy
 
PDF
Building Your Online Portfolio
WebStackAcademy
 
PDF
Front-End Developer's Career Roadmap
WebStackAcademy
 
PDF
Angular - Chapter 9 - Authentication and Authorization
WebStackAcademy
 
PDF
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
PDF
Angular - Chapter 6 - Firebase Integration
WebStackAcademy
 
PDF
Angular - Chapter 5 - Directives
WebStackAcademy
 
PDF
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
PDF
Angular - Chapter 3 - Components
WebStackAcademy
 
PDF
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
PDF
Angular - Chapter 1 - Introduction
WebStackAcademy
 
PDF
JavaScript - Chapter 10 - Strings and Arrays
WebStackAcademy
 
PDF
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
PDF
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Webstack Academy - Course Demo Webinar and Placement Journey
WebStackAcademy
 
WSA: Scaling Web Service to Handle Millions of Requests per Second
WebStackAcademy
 
WSA: Course Demo Webinar - Full Stack Developer Course
WebStackAcademy
 
Career Building in AI - Technologies, Trends and Opportunities
WebStackAcademy
 
Webstack Academy - Internship Kick Off
WebStackAcademy
 
Building Your Online Portfolio
WebStackAcademy
 
Front-End Developer's Career Roadmap
WebStackAcademy
 
Angular - Chapter 9 - Authentication and Authorization
WebStackAcademy
 
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular - Chapter 6 - Firebase Integration
WebStackAcademy
 
Angular - Chapter 5 - Directives
WebStackAcademy
 
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Angular - Chapter 3 - Components
WebStackAcademy
 
Angular - Chapter 2 - TypeScript Programming
WebStackAcademy
 
Angular - Chapter 1 - Introduction
WebStackAcademy
 
JavaScript - Chapter 10 - Strings and Arrays
WebStackAcademy
 
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 

Recently uploaded (20)

PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
PDF
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Captain IT
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Captain IT
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
This slide provides an overview Technology
mineshkharadi333
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 

jQuery - Chapter 1 - Introduction

  • 3. www.webstackacademy.com What is a jQuery? • jQuery (https://jquery.com/) is a lightweight, feature rich JavaScript library • jQuery provides easy-to-use APIs to achieve the following: o Manipulate HTML, CSS and DOM o Handling HTML events o Applying effects and animations o AJAX o Utilities • This is one of the most popularly used OpenSource libraries • Developers can do more with lesser number of lines of code, compared with vanilla JavaScript
  • 4. www.webstackacademy.com jQuery is very popular • Most popular and extendable library for websites and mobile single page app development • As of June 2018, jQuery is used on 73% of the top 1 million websites, and by 22.4% of overall number of websites • Most of the big companies (ex: Google) use jQuery library and host jQuery CDN (Both Google and Microsoft) • jQuery simplifies the syntax for finding, selecting, and manipulating DOM elements • Supported by all modern browsers
  • 5. www.webstackacademy.com History of jQuery • Originally created in Jan 2006 at a BarCamp by John Resig (who became very popular for his work in jQuery) • Official major releases were made in the following time-lines: o 1.0 - Aug 2006 o 2.0 - Jan 2014 o 3.0 - Jun 2016 o 3.3.1 - Jan 2018 (which we will be using!) • The jQuery team also developed jQuery mobile (for mobile / touch devices) and jQuery UI (for developing GUI) which has also become popular
  • 6. www.webstackacademy.com jQuery CDN • Both Google and Microsoft host jQuery, links are provided below Google CDN : <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> Microsoft CDN : <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"> </script> • For our learning, you can either use CDN or include a local copy of jQuery library • Local downloaded copy is available at Google Drive
  • 7. www.webstackacademy.com jQuery Development Principles • P1: Separation of HTML and JS o jQuery library provides simple syntax for handling DOMs (Ex: Events) o Hence, developers can avoid adding HTML event attributes to call JavaScript functions o By this way JavaScript code can be completely separated code from HTML • P2: Elimination of cross-browser incompatibilities o The JavaScript engines of different browsers differ from each other o Therefore, JavaScript code that works for one browser may not work for another o jQuery handles all these cross-browser inconsistencies and provides a consistent interface that works across different browsers • P3: Extensibility o New events, elements, and methods can be easily added and then reused as a plugin
  • 9. www.webstackacademy.com jQuery syntax • The jQuery syntax is tailored to select HTML elements and performing some action on them • Actions can be of varied in nature (ex: DOM manipulation, events etc..) which we will learn in subsequent chapters Syntax : $(selector).action() Selector : this | id | class | element $(this).action(); // Take action on current element $(“div”).action(); // Take action on all divisions $(“.abc”).action(); // Take action on all abc class
  • 10. www.webstackacademy.com jQuery syntax • The $ used is actually a jQuery function <script src="../jquery/jquery-3.3.1.min.js" type="text/javascript"></script> <script> /* If you remove jQuery inclusion above, you will get undefined here */ document.write("Type of $ = " + typeof $); if($ == jQuery) { document.write("<br>$ Function is referencing to jQuery "); } </script>
  • 11. www.webstackacademy.com jQuery ready event • Before accessing any element with jQuery, the DOM tree should be completely created • There could be following possible failures if document is not fully loaded o Finding an element that is not created o Hiding an element that is not created • jQuery detects the state of readiness of document then perform actions <script> $(document).ready(function() { document.write("Welcome to jQuery..."); document.write("DOM is created..."); }); </script>
  • 12. www.webstackacademy.com jQuery load event • Sometimes you may want the entire window to be loaded • Hence use the "load" method <script> $(window).on("load", function() { document.write("Window loaded!!") }); </script>
  • 13. www.webstackacademy.com jQuery passing named functions • U can also pass named functions to jQuery as follows <script> $(document).ready( myFunc ); // Calling your named function function myFunc() { console.log("DOM loaded"); } </script>
  • 14. www.webstackacademy.com jQuery no-conflict mode • By default, jQuery uses $ as a shortcut for jQuery • Thus, if you are using another JavaScript library that uses the $ variable, you can run into conflicts with jQuery • In order to avoid these conflicts, you need to put jQuery in no-conflict mode immediately after it is loaded onto the page and before you attempt to use jQuery in your page
  • 15. www.webstackacademy.com jQuery no-conflict mode <script> /* Creating alias for jQuery function */ jQuery.noConflict(); jQuery(document).ready(function( $ ) { /* You can use the locally-scoped $ here */ $( "#hidden-para" ).hide(); console.log("jQuery in no-conflict mode"); }); /* You can call other 3rd party library functions here * $(document).thirdPartyFunc(); * The $ above is 3rd party function reference. */ </script>
  • 16. www.webstackacademy.com WebStack Academy #83, Farah Towers, 1st Floor, MG Road, Bangalore – 560001 M: +91-809 555 7332 E: [email protected] WSA in Social Media: