SlideShare a Scribd company logo
Powerful
https://www.udemy.com/web-development-introduction-to-jquery/?couponCode=SLIDESHARE
The most popular JavaScript library in use today
Installed on 65% of the top 10 million highest-trafficked sites on
the Web
jQuery is free, open-source software licensed under the MIT
License
jQuery is a JavaScript Library
It simplifies JavaScript programming
jQuery wraps common JavaScript tasks into a method which you
can then call with simple lines of code.
Makes it easier to navigate a document
Select DOM elements
Create animations
Handles Events
Use AJAX
Create powerful dynamic interactions with web
users via jQuery
jQuerycom
Having a experience with JavaScript and CSS will
help you get started with jQuery quicker
It’s small in size and loads quickly
Really powerful features allow you to create interactions faster
Simple straight forward
Selectors are the same as CSS
It’s easy to learn and get started with
Easier to add JavaSCript functionality to your website
JQUERY
Powerful
Introduction to jQuery
There are a number of way to get jquery
 http://jquery.com/download/
 Use CDN (Content Delivery Network)
https://developers.google.com/speed/libraries/
If you download make sure you place it in a directory that your can
access it from.
Benefits of CDN - visitors may already have it cached within their
browsers, which allows for quicker load times.
Including the library jQuery
Link to
<script
src="https://ajax.googleapis.com/ajax/libs/
jquery/1.12.2/jquery.min.js"></script>
Powerful
JQUERY
INTRODUCTION TO DOCUMENT OBJECT MODEL
jQuery, at its core, is a DOM (Document Object Model) manipulation library.
So understanding the DOM is important to understanding how jQuery works.
INTRODUCTION TO DOCUMENT OBJECT MODEL
jQuery, at its core, is a DOM (Document Object Model) manipulation library.
So understanding the DOM is important to understanding how jQuery works.
WHAT IS THE DOM? DOCUMENT OBJECT MODEL
https://en.wikipedia.org/wiki/Document_Object_Model
The Document Object Model (DOM) is a cross-platform and language-
independent convention for representing and interacting with objects in
HTML, XHTML, and XML documents. The nodes of every document are
organized in a tree structure, called the DOM tree. Objects in the DOM tree
may be addressed and manipulated by using methods on the objects. The public
interface of a DOM is specified in its application programming interface (API).
WHAT IS THE DOM? DOCUMENT OBJECT MODEL
JavaScript allows for client-side interactivity.
DOM is the standardized format for the complete model
of the webpage. Its provides a means to change any
portion of the document, handle events, and more.
To render an HTML page, most web browsers use an
internal model similar to the DOM. Nodes ( all the pieces
of the page ) are organized in a tree structure. The tree
stems from a main node referred to as the document
object.
WHAT IS THE DOM? DOCUMENT OBJECT MODEL
When a web page is loaded it creates a DOM of the
page.
JavaScript can
● JavaScript can add, change, and remove all the
HTML elements and attributes in the page
● JavaScript can change all the CSS styles in the
page
● JavaScript can react to all existing events in the
page
● JavaScript can create new events in the page
WHAT IS THE DOM? DOCUMENT OBJECT MODEL
Chrome comes with a built in DOM inspector.
We want the page to fully load before we try to access
page content!
Powerful
JQUERY
JQUERY $
Jquery Object $ uses $ to define jQuery. jQuery has two usage styles:
Via the $ function, which is a factory method for the jQuery object. These functions, often called
commands, are chainable as they all return jQuery objects.
Via $.-prefixed functions. These are utility functions, which do not act upon the jQuery object
directly.
Selectors are CSS syntax - if you are familiar with CSS selectors, jQuery selectors will be
straightforward.
JQUERY
jQuery is run when the document is ready.
<script type="text/javascript">
$(document).ready(function(){
// jQuery code
});
</script>
JQUERY
Same as the $(document).ready(function(){ but shorter. You can use either.
<script type="text/javascript">
$(function(){
// jQuery code
});
</script>
Web Development Introduction to jQuery
JQUERY SELECTORS
jQuery Selectors
Works like CSS and has its own custom selectors.
Once selected you probably will want to do something with the element.
Example l1.html
HTML AND DOM MANIPULATION
The DOM allows scripts to access and manipulate web documents.
text()
html()
val()
Example script1.js
SELECTORS SET
$(“id”).html(‘new’);
$(“.class”).html(‘new’);
$(“p”).html(‘new’);
Setting content to value of new
Changing page content
Update your HTML with jquery
SELECTORS GET
$(“#id”).html();
$(“.class”).html(); - this returns the first class value
$(“p”).html(); - this returns the first tag value
You should be specific with get on the content. Content should be retrieved from a single
element.
Get page content
SELECTORS EXPLICIT ITERATION
Looping of multiple elements.
When you loop you generally may want to apply specific changes to each of the matching
selections.
Appending of content
But you can also list out selections individually….
UPDATING HTML USING JQUERY
Append
After
prepend
Before
Empty
Remove
Although they may initially sound similar there are differences.
Events
User initiates a trigger
Most commonly used are click events
$( 'li' ).click(function( event ) {
console.log( 'clicked', $( this ).text() );
});
stops the default action of an element from
happening.
event.preventDefault();
<a></a> hyperlinks…...
hover()
dbclick()
Mousedown()
mouseenter()
mousemove()
mouseleave()
mouseover();
mouseup();
keydown() keyup()
keypress()
Get key information
blur()
focus()
change()
submit()
Traversing
JQUERY
JQUERY TRAVERSING
HTML elements in relation to other HTML elements.
Moving from the starting point element to other elements
within the page until you reach the desired element.
Parents
Children
siblings
JQUERY TRAVERSING FAMILY
First top element that contains others is an ancestor or parent
to the elements within it.
Child is descendant of the parent, and sibling to the other
elements that share the same parent.
Parent is the immediate parent whereas parents are all
ancestors up to html
JQUERY TRAVERSING FIND
Gets all the descendants of each element
JQUERY TRAVERSING SIBLINGS
next()
siblings()
nextAll()
JQUERY TRAVERSING FILTERING
first()
last()
eq()
CSS
css(propName,value)
Add classes
Remove classes
attributes
EFFECTS and ANIMATIONS
Simple hide() and show()
Fading effects
fadeIn()
fadeOut();
fadeTo();
Sliding moving the element
slideDown()
slideUp()
slideToggle()
You can perform animation
.animate()
You can add more than one effect chaining
methods together in jQuery
jQuery AJAX
Powerful
What is AJAX
asynchronous JavaScript and XML
Using AJAX web applications can send data to and retrieve data
from a server without page reloads. Ability to change content
dynamically.
Despite the name, the use of XML is not required (JSON is often
used in the AJAJ variant), and the requests do not need to be
asynchronous.
JavaScript Object Notation (JSON) is often used as an alternative
format for data interchange, although other formats such as
preformatted HTML or plain text can also be used
https://en.wikipedia.org/wiki/Ajax_(programming)
AJAX
AJAX requests happen in the background making them invisible to
the user.
Allowing you to access data that is not currently loaded within the
page.
Behavior is smooth and seamless
jQuery make AJAX easy
$.get(), $.post(), load(), $.getJSON(), $.post(), $.ajax()
Web Development Introduction to jQuery
What is JSON
JSON is an open-standard format that uses human-readable text
to transmit data objects consisting of attribute–value pairs. It is
the most common data format used for asynchronous
browser/server communication (AJAJ), largely replacing XML
which is used by AJAX.
JSON is a language-independent data format
Using LOAD() to get data
$(“#output”).load('php.php');
Uses Selectors to load the result of the AJAX call inside the
selected element
Using Get to get data
$.get('php.php', function (data) {
///reads contents of php.php into data
});
Handles the success response of the AJAX call
Free to define the behavior you want
Simple way to make AJAX calls
Static and dynamic documents both work
Using GetJSON to get data
$.get('php.php', function (data) {
///reads contents of php.php into data
});
Result type is expected JSON format
Shorthand for get retriving JSON data
Using AJAX post
$.post('php.php', data, function (data) {
///reads contents of php.php into data
});
Send data to server securely
jQuery $.ajax()
More control with settings
Used when other methods cannot be used
More about AJAX
http://api.jquery.com/category/ajax/
Same Origin policy
https://en.wikipedia.org/wiki/Same-origin_policy
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
Get the course
https://www.udemy.com/web-development-introduction-to-
jquery/?couponCode=SLIDESHARE

More Related Content

PPTX
Jquery beltranhomewrok
Catherine Beltran
 
PDF
Javascript, DOM, browsers and frameworks basics
Net7
 
PPTX
A Rich Web Experience with jQuery, Ajax and .NET
James Johnson
 
PDF
jQuery -Chapter 2 - Selectors and Events
WebStackAcademy
 
PPTX
Dom(document object model)
Partnered Health
 
PDF
Web 5 | JavaScript Events
Mohammad Imam Hossain
 
PPTX
A Rich Web experience with jQuery, Ajax and .NET
James Johnson
 
Jquery beltranhomewrok
Catherine Beltran
 
Javascript, DOM, browsers and frameworks basics
Net7
 
A Rich Web Experience with jQuery, Ajax and .NET
James Johnson
 
jQuery -Chapter 2 - Selectors and Events
WebStackAcademy
 
Dom(document object model)
Partnered Health
 
Web 5 | JavaScript Events
Mohammad Imam Hossain
 
A Rich Web experience with jQuery, Ajax and .NET
James Johnson
 

What's hot (20)

PPTX
SharePoint and jQuery Essentials
Mark Rackley
 
PPTX
jQuery
Dileep Mishra
 
PPT
J Query Public
pradeepsilamkoti
 
PDF
Web2 - jQuery
voicerepublic
 
PDF
Jquery tutorial-beginners
Isfand yar Khan
 
PDF
Learn css3
Mostafa Bayomi
 
PDF
JavaScript DOM & event
Borey Lim
 
PPTX
Jquery Basics
Umeshwaran V
 
PPTX
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Ayes Chinmay
 
PPTX
Internet and Web Technology (CLASS-6) [BOM]
Ayes Chinmay
 
PDF
Dom
soumya
 
PDF
Intro to jQuery
Shawn Calvert
 
PPTX
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Ayes Chinmay
 
PDF
Introduction to jQuery
Zeeshan Khan
 
PPT
J query b_dotnet_ug_meet_12_may_2012
ghnash
 
PDF
JavaScript and BOM events
Jussi Pohjolainen
 
PDF
Intro to Javascript and jQuery
Shawn Calvert
 
PPTX
jQuery
Vishwa Mohan
 
PPTX
A to Z about JQuery - Become Newbie to Expert Java Developer
Manoj Bhuva
 
SharePoint and jQuery Essentials
Mark Rackley
 
J Query Public
pradeepsilamkoti
 
Web2 - jQuery
voicerepublic
 
Jquery tutorial-beginners
Isfand yar Khan
 
Learn css3
Mostafa Bayomi
 
JavaScript DOM & event
Borey Lim
 
Jquery Basics
Umeshwaran V
 
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Ayes Chinmay
 
Internet and Web Technology (CLASS-6) [BOM]
Ayes Chinmay
 
Dom
soumya
 
Intro to jQuery
Shawn Calvert
 
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Introduction to jQuery
Zeeshan Khan
 
J query b_dotnet_ug_meet_12_may_2012
ghnash
 
JavaScript and BOM events
Jussi Pohjolainen
 
Intro to Javascript and jQuery
Shawn Calvert
 
jQuery
Vishwa Mohan
 
A to Z about JQuery - Become Newbie to Expert Java Developer
Manoj Bhuva
 
Ad

Viewers also liked (20)

PPS
El TRIPLE FILTRO
José Páez Mendoza
 
DOCX
Sistema educativo
Sandy Alcocer Silva
 
DOCX
Respeto
hsbc28
 
DOCX
ORLYNE RIVERO CV
Orlyne Rivero
 
PPTX
Getting to Know Bootstrap for Rapid Web Development
Laurence Svekis ✔
 
PDF
Het aanbrengen van de eerste ontwerpen in het Rijnstate ziekenhuis in Arnhem
Gabrielle Thijsen
 
PDF
Improving Responsive Web Design Process 2016
Cristina Chumillas
 
PDF
IROS 2015 - Manuscript 1
Matthew Chan
 
PPT
3. Domingo Pérez experiencias significativas servicio comunitario
upel iprem
 
PDF
How to build a html5 websites.v1
Bitla Software
 
PPTX
Siti
febritalia
 
PPTX
.NET Standard - Under the Hood
Immo Landwerth
 
PPTX
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
Estelle Weyl
 
PDF
HTML5 Introduction
dynamis
 
ODP
Introduction to jQuery
manugoel2003
 
PPT
Introduction to Android Environment
Compare Infobase Limited
 
PDF
HTML5 and CSS3 Today
Brian Hogan
 
PPTX
Responsive Web Design for Universal Access 2016
Kate Walser
 
PPTX
Jquery introduction
musrath mohammad
 
PPT
jQuery introduction
Tomi Juhola
 
El TRIPLE FILTRO
José Páez Mendoza
 
Sistema educativo
Sandy Alcocer Silva
 
Respeto
hsbc28
 
ORLYNE RIVERO CV
Orlyne Rivero
 
Getting to Know Bootstrap for Rapid Web Development
Laurence Svekis ✔
 
Het aanbrengen van de eerste ontwerpen in het Rijnstate ziekenhuis in Arnhem
Gabrielle Thijsen
 
Improving Responsive Web Design Process 2016
Cristina Chumillas
 
IROS 2015 - Manuscript 1
Matthew Chan
 
3. Domingo Pérez experiencias significativas servicio comunitario
upel iprem
 
How to build a html5 websites.v1
Bitla Software
 
.NET Standard - Under the Hood
Immo Landwerth
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
Estelle Weyl
 
HTML5 Introduction
dynamis
 
Introduction to jQuery
manugoel2003
 
Introduction to Android Environment
Compare Infobase Limited
 
HTML5 and CSS3 Today
Brian Hogan
 
Responsive Web Design for Universal Access 2016
Kate Walser
 
Jquery introduction
musrath mohammad
 
jQuery introduction
Tomi Juhola
 
Ad

Similar to Web Development Introduction to jQuery (20)

PPTX
Upstate CSCI 450 jQuery
DanWooster1
 
PDF
jQuery
Ivano Malavolta
 
PPT
JQuery introduction
NexThoughts Technologies
 
PPT
J query presentation
sawarkar17
 
PPT
J query presentation
akanksha17
 
PPTX
J Query The Write Less Do More Javascript Library
rsnarayanan
 
PPTX
Web technologies-course 11.pptx
Stefan Oprea
 
PPTX
jQuery
Jay Poojara
 
PPT
jQuery Introduction/ jquery basic concept
MuhammadJameel83
 
PPTX
jQuery basics for Beginners
Pooja Saxena
 
PDF
Javascript libraries
Dumindu Pahalawatta
 
ODP
Jquery- One slide completing all JQuery
Knoldus Inc.
 
KEY
Week 4 - jQuery + Ajax
baygross
 
PDF
Learning jQuery made exciting in an interactive session by one of our team me...
Thinqloud
 
PPTX
Introduction to Jquery
Ahmed Elharouny
 
PPTX
jQuery
Jon Erickson
 
PPTX
Html dom & j query
hafeez1216
 
PPT
J query introduction
SMS_VietNam
 
PDF
jQuery Interview Questions By ScholarHat.pdf
Scholarhat
 
Upstate CSCI 450 jQuery
DanWooster1
 
JQuery introduction
NexThoughts Technologies
 
J query presentation
sawarkar17
 
J query presentation
akanksha17
 
J Query The Write Less Do More Javascript Library
rsnarayanan
 
Web technologies-course 11.pptx
Stefan Oprea
 
jQuery
Jay Poojara
 
jQuery Introduction/ jquery basic concept
MuhammadJameel83
 
jQuery basics for Beginners
Pooja Saxena
 
Javascript libraries
Dumindu Pahalawatta
 
Jquery- One slide completing all JQuery
Knoldus Inc.
 
Week 4 - jQuery + Ajax
baygross
 
Learning jQuery made exciting in an interactive session by one of our team me...
Thinqloud
 
Introduction to Jquery
Ahmed Elharouny
 
jQuery
Jon Erickson
 
Html dom & j query
hafeez1216
 
J query introduction
SMS_VietNam
 
jQuery Interview Questions By ScholarHat.pdf
Scholarhat
 

More from Laurence Svekis ✔ (20)

PDF
Quiz JavaScript Objects Learn more about JavaScript
Laurence Svekis ✔
 
PDF
JavaScript Lessons 2023 V2
Laurence Svekis ✔
 
PDF
JavaScript Lessons 2023
Laurence Svekis ✔
 
PDF
Top 10 Linkedin Tips Guide 2023
Laurence Svekis ✔
 
PDF
JavaScript Interview Questions 2023
Laurence Svekis ✔
 
PDF
Code examples javascript ebook
Laurence Svekis ✔
 
PDF
Javascript projects Course
Laurence Svekis ✔
 
PDF
10 java script projects full source code
Laurence Svekis ✔
 
PDF
Chrome DevTools Introduction 2020 Web Developers Guide
Laurence Svekis ✔
 
PDF
Brackets code editor guide
Laurence Svekis ✔
 
PDF
Web hosting get start online
Laurence Svekis ✔
 
PDF
JavaScript guide 2020 Learn JavaScript
Laurence Svekis ✔
 
PDF
Web hosting Free Hosting
Laurence Svekis ✔
 
PDF
Web development resources brackets
Laurence Svekis ✔
 
PPTX
Google Apps Script for Beginners- Amazing Things with Code
Laurence Svekis ✔
 
PPTX
Local SQLite Database with Node for beginners
Laurence Svekis ✔
 
PDF
Introduction to Node js for beginners + game project
Laurence Svekis ✔
 
PPTX
JavaScript DOM - Dynamic interactive Code
Laurence Svekis ✔
 
PPTX
JavaScript Advanced - Useful methods to power up your code
Laurence Svekis ✔
 
PPTX
Monster JavaScript Course - 50+ projects and applications
Laurence Svekis ✔
 
Quiz JavaScript Objects Learn more about JavaScript
Laurence Svekis ✔
 
JavaScript Lessons 2023 V2
Laurence Svekis ✔
 
JavaScript Lessons 2023
Laurence Svekis ✔
 
Top 10 Linkedin Tips Guide 2023
Laurence Svekis ✔
 
JavaScript Interview Questions 2023
Laurence Svekis ✔
 
Code examples javascript ebook
Laurence Svekis ✔
 
Javascript projects Course
Laurence Svekis ✔
 
10 java script projects full source code
Laurence Svekis ✔
 
Chrome DevTools Introduction 2020 Web Developers Guide
Laurence Svekis ✔
 
Brackets code editor guide
Laurence Svekis ✔
 
Web hosting get start online
Laurence Svekis ✔
 
JavaScript guide 2020 Learn JavaScript
Laurence Svekis ✔
 
Web hosting Free Hosting
Laurence Svekis ✔
 
Web development resources brackets
Laurence Svekis ✔
 
Google Apps Script for Beginners- Amazing Things with Code
Laurence Svekis ✔
 
Local SQLite Database with Node for beginners
Laurence Svekis ✔
 
Introduction to Node js for beginners + game project
Laurence Svekis ✔
 
JavaScript DOM - Dynamic interactive Code
Laurence Svekis ✔
 
JavaScript Advanced - Useful methods to power up your code
Laurence Svekis ✔
 
Monster JavaScript Course - 50+ projects and applications
Laurence Svekis ✔
 

Recently uploaded (20)

PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PDF
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PPTX
How tech helps people in the modern era.
upadhyayaryan154
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PPT
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PPTX
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
PDF
Generative AI Foundations: AI Skills for the Future of Work
hemal sharma
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PPTX
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
PDF
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PPTX
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
Centralized Business Email Management_ How Admin Controls Boost Efficiency & ...
XgenPlus Technologies
 
Crypto Recovery California Services.pptx
lionsgate network
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
How tech helps people in the modern era.
upadhyayaryan154
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
The Latest Scam Shocking the USA in 2025.pptx
onlinescamreport4
 
Generative AI Foundations: AI Skills for the Future of Work
hemal sharma
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
Artificial-Intelligence-in-Daily-Life (2).pptx
nidhigoswami335
 
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 

Web Development Introduction to jQuery

  • 2. The most popular JavaScript library in use today Installed on 65% of the top 10 million highest-trafficked sites on the Web jQuery is free, open-source software licensed under the MIT License jQuery is a JavaScript Library It simplifies JavaScript programming
  • 3. jQuery wraps common JavaScript tasks into a method which you can then call with simple lines of code. Makes it easier to navigate a document Select DOM elements Create animations Handles Events Use AJAX
  • 4. Create powerful dynamic interactions with web users via jQuery
  • 5. jQuerycom Having a experience with JavaScript and CSS will help you get started with jQuery quicker
  • 6. It’s small in size and loads quickly Really powerful features allow you to create interactions faster Simple straight forward Selectors are the same as CSS It’s easy to learn and get started with Easier to add JavaSCript functionality to your website
  • 8. Introduction to jQuery There are a number of way to get jquery  http://jquery.com/download/  Use CDN (Content Delivery Network) https://developers.google.com/speed/libraries/ If you download make sure you place it in a directory that your can access it from. Benefits of CDN - visitors may already have it cached within their browsers, which allows for quicker load times.
  • 9. Including the library jQuery Link to <script src="https://ajax.googleapis.com/ajax/libs/ jquery/1.12.2/jquery.min.js"></script>
  • 11. INTRODUCTION TO DOCUMENT OBJECT MODEL jQuery, at its core, is a DOM (Document Object Model) manipulation library. So understanding the DOM is important to understanding how jQuery works.
  • 12. INTRODUCTION TO DOCUMENT OBJECT MODEL jQuery, at its core, is a DOM (Document Object Model) manipulation library. So understanding the DOM is important to understanding how jQuery works.
  • 13. WHAT IS THE DOM? DOCUMENT OBJECT MODEL https://en.wikipedia.org/wiki/Document_Object_Model The Document Object Model (DOM) is a cross-platform and language- independent convention for representing and interacting with objects in HTML, XHTML, and XML documents. The nodes of every document are organized in a tree structure, called the DOM tree. Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The public interface of a DOM is specified in its application programming interface (API).
  • 14. WHAT IS THE DOM? DOCUMENT OBJECT MODEL JavaScript allows for client-side interactivity. DOM is the standardized format for the complete model of the webpage. Its provides a means to change any portion of the document, handle events, and more. To render an HTML page, most web browsers use an internal model similar to the DOM. Nodes ( all the pieces of the page ) are organized in a tree structure. The tree stems from a main node referred to as the document object.
  • 15. WHAT IS THE DOM? DOCUMENT OBJECT MODEL When a web page is loaded it creates a DOM of the page. JavaScript can ● JavaScript can add, change, and remove all the HTML elements and attributes in the page ● JavaScript can change all the CSS styles in the page ● JavaScript can react to all existing events in the page ● JavaScript can create new events in the page
  • 16. WHAT IS THE DOM? DOCUMENT OBJECT MODEL Chrome comes with a built in DOM inspector. We want the page to fully load before we try to access page content!
  • 18. JQUERY $ Jquery Object $ uses $ to define jQuery. jQuery has two usage styles: Via the $ function, which is a factory method for the jQuery object. These functions, often called commands, are chainable as they all return jQuery objects. Via $.-prefixed functions. These are utility functions, which do not act upon the jQuery object directly. Selectors are CSS syntax - if you are familiar with CSS selectors, jQuery selectors will be straightforward.
  • 19. JQUERY jQuery is run when the document is ready. <script type="text/javascript"> $(document).ready(function(){ // jQuery code }); </script>
  • 20. JQUERY Same as the $(document).ready(function(){ but shorter. You can use either. <script type="text/javascript"> $(function(){ // jQuery code }); </script>
  • 22. JQUERY SELECTORS jQuery Selectors Works like CSS and has its own custom selectors. Once selected you probably will want to do something with the element. Example l1.html
  • 23. HTML AND DOM MANIPULATION The DOM allows scripts to access and manipulate web documents. text() html() val() Example script1.js
  • 25. SELECTORS GET $(“#id”).html(); $(“.class”).html(); - this returns the first class value $(“p”).html(); - this returns the first tag value You should be specific with get on the content. Content should be retrieved from a single element. Get page content
  • 26. SELECTORS EXPLICIT ITERATION Looping of multiple elements. When you loop you generally may want to apply specific changes to each of the matching selections. Appending of content But you can also list out selections individually….
  • 27. UPDATING HTML USING JQUERY Append After prepend Before Empty Remove Although they may initially sound similar there are differences.
  • 29. User initiates a trigger Most commonly used are click events $( 'li' ).click(function( event ) { console.log( 'clicked', $( this ).text() ); });
  • 30. stops the default action of an element from happening. event.preventDefault(); <a></a> hyperlinks…...
  • 36. JQUERY TRAVERSING HTML elements in relation to other HTML elements. Moving from the starting point element to other elements within the page until you reach the desired element. Parents Children siblings
  • 37. JQUERY TRAVERSING FAMILY First top element that contains others is an ancestor or parent to the elements within it. Child is descendant of the parent, and sibling to the other elements that share the same parent. Parent is the immediate parent whereas parents are all ancestors up to html
  • 38. JQUERY TRAVERSING FIND Gets all the descendants of each element
  • 41. CSS
  • 47. Sliding moving the element slideDown() slideUp() slideToggle()
  • 48. You can perform animation .animate()
  • 49. You can add more than one effect chaining methods together in jQuery
  • 51. What is AJAX asynchronous JavaScript and XML Using AJAX web applications can send data to and retrieve data from a server without page reloads. Ability to change content dynamically. Despite the name, the use of XML is not required (JSON is often used in the AJAJ variant), and the requests do not need to be asynchronous. JavaScript Object Notation (JSON) is often used as an alternative format for data interchange, although other formats such as preformatted HTML or plain text can also be used https://en.wikipedia.org/wiki/Ajax_(programming)
  • 52. AJAX AJAX requests happen in the background making them invisible to the user. Allowing you to access data that is not currently loaded within the page. Behavior is smooth and seamless jQuery make AJAX easy $.get(), $.post(), load(), $.getJSON(), $.post(), $.ajax()
  • 54. What is JSON JSON is an open-standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs. It is the most common data format used for asynchronous browser/server communication (AJAJ), largely replacing XML which is used by AJAX. JSON is a language-independent data format
  • 55. Using LOAD() to get data $(“#output”).load('php.php'); Uses Selectors to load the result of the AJAX call inside the selected element
  • 56. Using Get to get data $.get('php.php', function (data) { ///reads contents of php.php into data }); Handles the success response of the AJAX call Free to define the behavior you want Simple way to make AJAX calls Static and dynamic documents both work
  • 57. Using GetJSON to get data $.get('php.php', function (data) { ///reads contents of php.php into data }); Result type is expected JSON format Shorthand for get retriving JSON data
  • 58. Using AJAX post $.post('php.php', data, function (data) { ///reads contents of php.php into data }); Send data to server securely
  • 59. jQuery $.ajax() More control with settings Used when other methods cannot be used
  • 60. More about AJAX http://api.jquery.com/category/ajax/ Same Origin policy https://en.wikipedia.org/wiki/Same-origin_policy https://en.wikipedia.org/wiki/Cross-origin_resource_sharing Get the course https://www.udemy.com/web-development-introduction-to- jquery/?couponCode=SLIDESHARE