SlideShare ist ein Scribd-Unternehmen logo
1 von 16
JQuery
SCRIPTING LANGUAGES
JAVASCRIPT
Kumar Gaurav
k10gaurav@gmail.com
JQuery
 Powerful JavaScript library
 Simplify common JavaScript tasks
 Access parts of a page
 using CSS or XPath-like expressions
 Modify the appearance of a page
 Alter the content of a page
 Change the user’s interaction with a page
 Add animation to a page
 Provide AJAX support
 Abstract away browser quirks
Introductory Sample
<html>
<body>
<h1>Cities of the World</h1>
<dl>
<dt>Paris</dt><dd>Chic,
fashionable, expensive
rude</dd>
<dt>Sydney</dt><dd>Opera
house but no culture,
Mardi Gras,
fireworks</dd>
</dl>
</body>
</html>
h1 {font-size: 2.5em;
margin-bottom: 0;}
.emphasize {font-style:
italic; color:red;}
Basic JQuery
 Selecting part of document is fundamental
operation
 A JQuery object is a wrapper for a selected
group of DOM nodes
 $() function is a factory method that creates
JQuery objects
 $(“dt”) is a JQuery object containing all the “dt”
elements in the document
Continue…
 .addClass() method changes the
DOM nodes by adding a ‘class’
attribute
 The ‘class’ attribute is a special CSS
construct that provides a visual
architecture independent of the element
structures
 $(“dt”).addClass(“emphasize”) will
change all occurrences of <dt> to
<dt class=“emphasize”>
 See also .removeClass()
Continue…
 To make this change, put it in a
function and call it when the
document has been loaded and the
DOM is created
function doEmph(){$(“dt”).addClass(“emphasize”)}
<body onLoad=“doEmph()”>
 We had to alter the HTML (bad)
 Structure and appearance should be
separated!
 Also, onLoad waits until all images etc
are loaded. Tedious.
Continue…
 JQuery provides an independent
scheduling point after DOM is created
and before images are loaded
 $(document).ready(doEmph);
 No HTML mods required. All done in
script.
 Better solution:
 $(document).ready(function(){
$(“dt”).addClass(“emphasize”)
}); <html><head>
<script src="jquery.js" type="text/javascript"></script>
<script src="test.js" type="text/javascript"></script>
…
JQuery Selectors
 CSS
 p element name
 #id identifier
 .class classname
 p.class element with class
 p a anchor as any descendant of p
 p > a anchor direct child of p
Continue…
 XPath
/html/body//divpaths
a[@href] anchor with an href attr
div[ol] div with an ol inside
//a[@ref='nofollow'] any anchor with a specific value
for the ref attribute
JQuery Filters
 p:first first paragraph
 li:last last list item
 a:nth(3) fourth link
 a:eq(3) fourth link
 p:even or p:odd every other paragraph
 a:gt(3) or a:lt(4) every link after the 4th or up to the fourth
 a:contains(‘click’) links that contain the word click
Example
 JQuery uses chaining as follows
$(‘a:contains("ECS")’).
parent().
addClass("emphasize")
JQuery Events
 bind(eventname, function) method
 ‘click’
 ‘change’
 ‘resize’
 ‘ready’
 ‘mouseover’ & ‘mouseout’
 ‘live’ or ‘delegate’ or ‘on’
 ‘load’
 Etc…
 $(“a[@href]”).bind(‘click’,function(){
$(this).addClass(‘red’);});
Other JQuery Effects
 .css(‘property’, ‘value’)
 .css({‘prop1’:‘value1’,
‘prop2’:’value2’…})
E.g. .css(‘color’, ‘red’)
 .fadeIn(speed) or fadeOut(speed)
 .hide(speed) or .show(speed)
 Where speed is ‘slow’, ‘normal’ or ‘fast’
 Etc…
More JQuery Changes
DOM
 .attr({‘name’, ‘value’})
 sets a new attribute (or many)
 $(‘<i>hello</i>’)
 Creates a new element
 $(‘<i>hello</i>’).insertAfter(‘div.chapter p’);
 Creates element and inserts it into the document
 .html() or .text() or .empty() will replace
matched elements with newly created
elements
jQuery Sources
 Latest version 2.1.x
 jQuery Website https://jquery.com/download/
 Google Developers
https://ajax.googleapis.com/ajax/libs/jquery/2.1.
3/jquery.min.js
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryGunjan Kumar
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7phuphax
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
FYBSC IT Web Programming Unit IV PHP and MySQL
FYBSC IT Web Programming Unit IV  PHP and MySQLFYBSC IT Web Programming Unit IV  PHP and MySQL
FYBSC IT Web Programming Unit IV PHP and MySQLArti Parab Academics
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery BasicsKaloyan Kosev
 
jQuery - Chapter 5 - Ajax
jQuery - Chapter 5 -  AjaxjQuery - Chapter 5 -  Ajax
jQuery - Chapter 5 - AjaxWebStackAcademy
 
Javascript jQuery jQuery Ui
Javascript jQuery jQuery UiJavascript jQuery jQuery Ui
Javascript jQuery jQuery UiTom Friedhof
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attributeRichard Martens
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaztestingphase
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsAdégòkè Obasá
 

Was ist angesagt? (20)

jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7KMUTNB - Internet Programming 4/7
KMUTNB - Internet Programming 4/7
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Drupal.Behaviors
Drupal.BehaviorsDrupal.Behaviors
Drupal.Behaviors
 
FYBSC IT Web Programming Unit IV PHP and MySQL
FYBSC IT Web Programming Unit IV  PHP and MySQLFYBSC IT Web Programming Unit IV  PHP and MySQL
FYBSC IT Web Programming Unit IV PHP and MySQL
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
 
jQuery - Chapter 5 - Ajax
jQuery - Chapter 5 -  AjaxjQuery - Chapter 5 -  Ajax
jQuery - Chapter 5 - Ajax
 
Java script -23jan2015
Java script -23jan2015Java script -23jan2015
Java script -23jan2015
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Javascript jQuery jQuery Ui
Javascript jQuery jQuery UiJavascript jQuery jQuery Ui
Javascript jQuery jQuery Ui
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaz
 
IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps
 

Andere mochten auch

Andere mochten auch (6)

webstudy jquery
webstudy jquerywebstudy jquery
webstudy jquery
 
JavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQueryJavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQuery
 
jQuery Best Practice
jQuery Best Practice jQuery Best Practice
jQuery Best Practice
 
Introductory css and j query
Introductory css and j queryIntroductory css and j query
Introductory css and j query
 
JQuery: JavaScript Library of the Future
JQuery: JavaScript Library of the FutureJQuery: JavaScript Library of the Future
JQuery: JavaScript Library of the Future
 
J query 17-visual-cheat-sheet
J query 17-visual-cheat-sheetJ query 17-visual-cheat-sheet
J query 17-visual-cheat-sheet
 

Ähnlich wie jQuery Beginner

J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 
Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology updateDoug Domeny
 
Jquery tutorial
Jquery tutorialJquery tutorial
Jquery tutorialBui Kiet
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScriptbensmithett
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationMevin Mohan
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scalarostislav
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)Ajay Khatri
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And TricksLester Lievens
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationguest5d87aa6
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Foreverstephskardal
 

Ähnlich wie jQuery Beginner (20)

jquery.ppt
jquery.pptjquery.ppt
jquery.ppt
 
Jquery 2
Jquery 2Jquery 2
Jquery 2
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
J query training
J query trainingJ query training
J query training
 
Jquery
JqueryJquery
Jquery
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
Html5 and web technology update
Html5 and web technology updateHtml5 and web technology update
Html5 and web technology update
 
Jquery tutorial
Jquery tutorialJquery tutorial
Jquery tutorial
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScript
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
Jquery Basics
Jquery BasicsJquery Basics
Jquery Basics
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
jQuery - Tips And Tricks
jQuery - Tips And TricksjQuery - Tips And Tricks
jQuery - Tips And Tricks
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
前端概述
前端概述前端概述
前端概述
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 

Mehr von kumar gaurav

Need Of Enterprise Integration
Need Of Enterprise IntegrationNeed Of Enterprise Integration
Need Of Enterprise Integrationkumar gaurav
 
Mulesoft file connector
Mulesoft file connectorMulesoft file connector
Mulesoft file connectorkumar gaurav
 
Mulesoft http connector
Mulesoft http connectorMulesoft http connector
Mulesoft http connectorkumar gaurav
 
Reason to connect with Mulesoft
Reason to connect with MulesoftReason to connect with Mulesoft
Reason to connect with Mulesoftkumar gaurav
 
Mulesoft idempotent Message Filter
Mulesoft idempotent Message FilterMulesoft idempotent Message Filter
Mulesoft idempotent Message Filterkumar gaurav
 
Mulesoft Using Groovy Component
Mulesoft Using Groovy ComponentMulesoft Using Groovy Component
Mulesoft Using Groovy Componentkumar gaurav
 
Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport referencekumar gaurav
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applicationskumar gaurav
 
Mulesoft Solutions for Mobile
Mulesoft Solutions for MobileMulesoft Solutions for Mobile
Mulesoft Solutions for Mobilekumar gaurav
 
Mulesoft Solutions for SOA
Mulesoft Solutions for SOAMulesoft Solutions for SOA
Mulesoft Solutions for SOAkumar gaurav
 
Mulesoft Solutions for IoT
Mulesoft Solutions for IoTMulesoft Solutions for IoT
Mulesoft Solutions for IoTkumar gaurav
 
Mulesoft Anypoint platform for APIs
Mulesoft Anypoint platform for APIsMulesoft Anypoint platform for APIs
Mulesoft Anypoint platform for APIskumar gaurav
 
Oracle Managed Files Transfer- Key based authentication
Oracle Managed Files Transfer- Key based authenticationOracle Managed Files Transfer- Key based authentication
Oracle Managed Files Transfer- Key based authenticationkumar gaurav
 
Java collections concept
Java collections conceptJava collections concept
Java collections conceptkumar gaurav
 
Struggle that counts
Struggle that countsStruggle that counts
Struggle that countskumar gaurav
 
MySQL index optimization techniques
MySQL index optimization techniquesMySQL index optimization techniques
MySQL index optimization techniqueskumar gaurav
 
Security guidelines for web development
Security guidelines for web developmentSecurity guidelines for web development
Security guidelines for web developmentkumar gaurav
 
Oracle web center suit
Oracle web center suitOracle web center suit
Oracle web center suitkumar gaurav
 

Mehr von kumar gaurav (20)

Need Of Enterprise Integration
Need Of Enterprise IntegrationNeed Of Enterprise Integration
Need Of Enterprise Integration
 
Mulesoft file connector
Mulesoft file connectorMulesoft file connector
Mulesoft file connector
 
Mulesoft http connector
Mulesoft http connectorMulesoft http connector
Mulesoft http connector
 
Reason to connect with Mulesoft
Reason to connect with MulesoftReason to connect with Mulesoft
Reason to connect with Mulesoft
 
Mulesoft idempotent Message Filter
Mulesoft idempotent Message FilterMulesoft idempotent Message Filter
Mulesoft idempotent Message Filter
 
Mulesoft Using Groovy Component
Mulesoft Using Groovy ComponentMulesoft Using Groovy Component
Mulesoft Using Groovy Component
 
Mulesoft vm transport reference
Mulesoft vm transport referenceMulesoft vm transport reference
Mulesoft vm transport reference
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applications
 
Mulesoft Solutions for Mobile
Mulesoft Solutions for MobileMulesoft Solutions for Mobile
Mulesoft Solutions for Mobile
 
Mulesoft Solutions for SOA
Mulesoft Solutions for SOAMulesoft Solutions for SOA
Mulesoft Solutions for SOA
 
Mulesoft Solutions for IoT
Mulesoft Solutions for IoTMulesoft Solutions for IoT
Mulesoft Solutions for IoT
 
Mulesoft Anypoint platform for APIs
Mulesoft Anypoint platform for APIsMulesoft Anypoint platform for APIs
Mulesoft Anypoint platform for APIs
 
Oracle Managed Files Transfer- Key based authentication
Oracle Managed Files Transfer- Key based authenticationOracle Managed Files Transfer- Key based authentication
Oracle Managed Files Transfer- Key based authentication
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
Struggle that counts
Struggle that countsStruggle that counts
Struggle that counts
 
Team Work
Team WorkTeam Work
Team Work
 
MySQL index optimization techniques
MySQL index optimization techniquesMySQL index optimization techniques
MySQL index optimization techniques
 
Security guidelines for web development
Security guidelines for web developmentSecurity guidelines for web development
Security guidelines for web development
 
Java web services
Java web servicesJava web services
Java web services
 
Oracle web center suit
Oracle web center suitOracle web center suit
Oracle web center suit
 

Kürzlich hochgeladen

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Kürzlich hochgeladen (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

jQuery Beginner

  • 2. JQuery  Powerful JavaScript library  Simplify common JavaScript tasks  Access parts of a page  using CSS or XPath-like expressions  Modify the appearance of a page  Alter the content of a page  Change the user’s interaction with a page  Add animation to a page  Provide AJAX support  Abstract away browser quirks
  • 3. Introductory Sample <html> <body> <h1>Cities of the World</h1> <dl> <dt>Paris</dt><dd>Chic, fashionable, expensive rude</dd> <dt>Sydney</dt><dd>Opera house but no culture, Mardi Gras, fireworks</dd> </dl> </body> </html> h1 {font-size: 2.5em; margin-bottom: 0;} .emphasize {font-style: italic; color:red;}
  • 4. Basic JQuery  Selecting part of document is fundamental operation  A JQuery object is a wrapper for a selected group of DOM nodes  $() function is a factory method that creates JQuery objects  $(“dt”) is a JQuery object containing all the “dt” elements in the document
  • 5. Continue…  .addClass() method changes the DOM nodes by adding a ‘class’ attribute  The ‘class’ attribute is a special CSS construct that provides a visual architecture independent of the element structures  $(“dt”).addClass(“emphasize”) will change all occurrences of <dt> to <dt class=“emphasize”>  See also .removeClass()
  • 6. Continue…  To make this change, put it in a function and call it when the document has been loaded and the DOM is created function doEmph(){$(“dt”).addClass(“emphasize”)} <body onLoad=“doEmph()”>  We had to alter the HTML (bad)  Structure and appearance should be separated!  Also, onLoad waits until all images etc are loaded. Tedious.
  • 7. Continue…  JQuery provides an independent scheduling point after DOM is created and before images are loaded  $(document).ready(doEmph);  No HTML mods required. All done in script.  Better solution:  $(document).ready(function(){ $(“dt”).addClass(“emphasize”) }); <html><head> <script src="jquery.js" type="text/javascript"></script> <script src="test.js" type="text/javascript"></script> …
  • 8. JQuery Selectors  CSS  p element name  #id identifier  .class classname  p.class element with class  p a anchor as any descendant of p  p > a anchor direct child of p
  • 9. Continue…  XPath /html/body//divpaths a[@href] anchor with an href attr div[ol] div with an ol inside //a[@ref='nofollow'] any anchor with a specific value for the ref attribute
  • 10. JQuery Filters  p:first first paragraph  li:last last list item  a:nth(3) fourth link  a:eq(3) fourth link  p:even or p:odd every other paragraph  a:gt(3) or a:lt(4) every link after the 4th or up to the fourth  a:contains(‘click’) links that contain the word click
  • 11. Example  JQuery uses chaining as follows $(‘a:contains("ECS")’). parent(). addClass("emphasize")
  • 12. JQuery Events  bind(eventname, function) method  ‘click’  ‘change’  ‘resize’  ‘ready’  ‘mouseover’ & ‘mouseout’  ‘live’ or ‘delegate’ or ‘on’  ‘load’  Etc…  $(“a[@href]”).bind(‘click’,function(){ $(this).addClass(‘red’);});
  • 13. Other JQuery Effects  .css(‘property’, ‘value’)  .css({‘prop1’:‘value1’, ‘prop2’:’value2’…}) E.g. .css(‘color’, ‘red’)  .fadeIn(speed) or fadeOut(speed)  .hide(speed) or .show(speed)  Where speed is ‘slow’, ‘normal’ or ‘fast’  Etc…
  • 14. More JQuery Changes DOM  .attr({‘name’, ‘value’})  sets a new attribute (or many)  $(‘<i>hello</i>’)  Creates a new element  $(‘<i>hello</i>’).insertAfter(‘div.chapter p’);  Creates element and inserts it into the document  .html() or .text() or .empty() will replace matched elements with newly created elements
  • 15. jQuery Sources  Latest version 2.1.x  jQuery Website https://jquery.com/download/  Google Developers https://ajax.googleapis.com/ajax/libs/jquery/2.1. 3/jquery.min.js