SlideShare uma empresa Scribd logo
1 de 11
Umeshwaran.V
Expert Software Engineer
 Introduction to jQuery
 jQuery function
◦ Ready
◦ Selectors
◦ DOM Interaction
◦ Event Handling
◦ Ajax interaction
 jQuery is a framework of Javascript. It not a language,
but it is a well written JavaScript code.
 jQuery is a cross-platform JavaScript library designed to
simplify the client-side scripting of HTML.
 It is a fast and concise JavaScript Library that simplifies
◦ HTML document traversing
◦ Event handling
◦ Animating
◦ Ajax interactions for rapid web development
 Pre-defined library for jQery is downloadable in
http://jquery.com/
 Production version - this is for your live website because it has been minified and compressed
 Development version - this is for testing and development (uncompressed and readable code)
 The jQuery library is a single JavaScript file, and you reference it with the HTML
<script> tag (notice that the <script> tag should be inside the <head> section):
<head>
<script src="jquery-1.11.0.min.js“ type=“text/javascript”></script>
</head>
 The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s).
◦ Basic syntax is: $(selector).action()
◦ A $ sign to define/access jQuery
◦ A (selector) to "query (or find)" HTML elements
◦ A jQuery action() to be performed on the element(s)
◦ E.g : - $("#test").hide() - hides the element with id="test“
 If you don't want to download and host jQuery yourself, you can include it from a CDN (Content
Delivery Network) Both Google and Microsoft host jQuery.
◦ Google
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
◦ Microsoft
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js"></script>
</head>
 Detecting When a Page has Loaded
 Use $(document).ready() to detect when a page has loaded and is
ready to use
 Called once DOM hierarchy is loaded
<script type="text/javascript">
$(document).ready(function(){
//Perform action here
});
</script>
 Select a element on page
 Selectors can be basis of html Tags, ID or Class
 Selector Syntax :
$(selectorExpression) eg: $(‘div’).Action()
To Select the specific tags use ,a $(‘div,p,span’)
To select Descendants use space $(‘div span’)
To select Tags by id prefix id with # $(‘#myDiv’)
To select Tags by class prefix with class . $(‘.myClass’)
Combine class with specific tag $(‘a.myClass’)
Select by attribute, tag and attribute and specific
attribute value,
$(‘[title]’), $(‘div[title]’), $(‘[title=“MyTest”]’) and
$(div[title=“MyTest”]’)
Input Selectors $(‘:input’) select all input elements. $(‘:input’)
:Contains – select elements that match the search $(‘div:contains(“C#”)’)
:odd or :even – format the table rows $(‘tr:oddd’) or $(‘tr:even’)
^-Startwith $-Endswith *-contains stated value $(‘input[id$=“Name”]’)
 Object Model – each element in the html is parsing
as DOM.
 jQuery provides set of function to interact the
DOM.
.each(function (index,element)) – is to iterate through
jquery objects
div.each(function(index,elem){ alert($(elem));});
this.propertyName=“value” is used to modify an object
property directly
$("div").each(function (i) {this.title = "My title " + I;});
.attr(attributeName) object attribute can be accessed Var title=$(‘#myDiv’).attr(“title”);
.attr(attributeName,value) can modify the object attributes $(‘#myDiv’).attr(‘title’, ‘My New title’);
.attr – modify multiple attributes pass json object contains
name/value pairs
$('#myDiv').attr({ title: 'My new Title‘, style: 'border:2px
solid black;’ });
.css(key,value ) - Modifying styles and it can be passed as
json object.
$(‘div’).css(‘color’,’red’)
Modifiying classes - .addClass(), .hasClass(), removeClass
and toggleClass()
$(‘#myDiv’).addClass(‘newClass’)
 Events notify a program that a user performed some type of action
 jQuery provides a cross-browser event model that works in IE,
Chrome, Opera, FireFox, Safari and more
 jQuery event model is simple to use and provides a compact syntax
 click()
 blur()
 focus()
 dblclick()
 mousedown()
 mouseup()
 mouseover()
 keydown(),
 keypress()
$(document).ready(function () {
$('#clickButton').click(function () {
alert($('#firstName').val());
});
});
Enter your name : <input type="text"
id="firstName" />
<input type="button" id="clickButton"
value="Click Me" />
<input type="button" id="clearButton"
value="Clear" />
 The on() function is a new replacement for the following:
◦ bind()
◦ delegate()
◦ live()
 Multiple events and handlers can be defined in on() using a "map":
$("#MyTable tr").on({
mouseenter: function(){
$(this).addClass("over");
},
mouseleave: function(){
$(this).removeClass("out");
}
});
Hover events can be handled using hover():
$(selector).hover(hoverIn, hoverOut)
$('div').on('click', function(){
alert('Clicked button!');
});
 Ajax allow to make a call with out full page post back.
 jQuery Ajax functions support cross-browser
compatibility.
 It supports Get and Post form actions
 Load JSON, XML, HTML or even scripts.
 jQuery provides several Ajax selectors cab be used to send
and receive data.
◦ load(URL,data,callback)– Loads HTML data from the server
◦ $.get(URL,callback)- Requests data from a specified resource. The
GET method may return cached data.
◦ $.post(URL,data,callback)– Submits data to be processed to a
specified resource. It can also be used to get data, the POST
method NEVER caches data, and is often used to send data along
with the request.
◦ $.getJSON( url, data, callback ) – Get/Post and return JSON
◦ $.ajax( url [, settings ] ) – Provides core functionality
E-Mail - Umeshwaran.Vijayan@misys.com

Mais conteúdo relacionado

Mais procurados

Jquery presentation
Jquery presentationJquery presentation
Jquery presentationMevin Mohan
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryshabab shihan
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Ayes Chinmay
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery jsonabksharma
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1Sebastian Pożoga
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Libraryrsnarayanan
 

Mais procurados (20)

Jquery
JqueryJquery
Jquery
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
J query training
J query trainingJ query training
J query training
 
jQuery Best Practice
jQuery Best Practice jQuery Best Practice
jQuery Best Practice
 
Jquery
JqueryJquery
Jquery
 
jQuery
jQueryjQuery
jQuery
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQuery
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
jQuery
jQueryjQuery
jQuery
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery json
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Jquery
JqueryJquery
Jquery
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
J Query The Write Less Do More Javascript Library
J Query   The Write Less Do More Javascript LibraryJ Query   The Write Less Do More Javascript Library
J Query The Write Less Do More Javascript Library
 

Destaque

Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScriptWill Livengood
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming LanguageRaghavan Mohan
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScriptT11 Sessions
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming languageMarco Cedaro
 
Introduction to JavaScript Programming
Introduction to JavaScript ProgrammingIntroduction to JavaScript Programming
Introduction to JavaScript ProgrammingRaveendra R
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in JavascriptKnoldus Inc.
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptBryan Basham
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An IntroductionManvendra Singh
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioLuis Atencio
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 

Destaque (19)

Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming language
 
Introduction to JavaScript Programming
Introduction to JavaScript ProgrammingIntroduction to JavaScript Programming
Introduction to JavaScript Programming
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in Javascript
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Js ppt
Js pptJs ppt
Js ppt
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 

Semelhante a Jquery Basics

Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaztestingphase
 
Jquery- One slide completing all JQuery
Jquery- One slide completing all JQueryJquery- One slide completing all JQuery
Jquery- One slide completing all JQueryKnoldus Inc.
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuerykolkatageeks
 
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
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxAditiPawale1
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript DevelopmentTommy Vercety
 
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETJames Johnson
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQueryPhDBrown
 

Semelhante a Jquery Basics (20)

Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaz
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
jQuery
jQueryjQuery
jQuery
 
Jquery- One slide completing all JQuery
Jquery- One slide completing all JQueryJquery- One slide completing all JQuery
Jquery- One slide completing all JQuery
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
J query
J queryJ query
J query
 
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_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
 
01 Introduction - JavaScript Development
01 Introduction - JavaScript Development01 Introduction - JavaScript Development
01 Introduction - JavaScript Development
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
UNIT 1 (7).pptx
UNIT 1 (7).pptxUNIT 1 (7).pptx
UNIT 1 (7).pptx
 
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham SiddiquiJ Query (Complete Course) by Muhammad Ehtisham Siddiqui
J Query (Complete Course) by Muhammad Ehtisham Siddiqui
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 
Web2 - jQuery
Web2 - jQueryWeb2 - jQuery
Web2 - jQuery
 
JQuery Overview
JQuery OverviewJQuery Overview
JQuery Overview
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQuery
 
jQuery Presentasion
jQuery PresentasionjQuery Presentasion
jQuery Presentasion
 
jQuery
jQueryjQuery
jQuery
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Jquery Basics

  • 2.  Introduction to jQuery  jQuery function ◦ Ready ◦ Selectors ◦ DOM Interaction ◦ Event Handling ◦ Ajax interaction
  • 3.  jQuery is a framework of Javascript. It not a language, but it is a well written JavaScript code.  jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.  It is a fast and concise JavaScript Library that simplifies ◦ HTML document traversing ◦ Event handling ◦ Animating ◦ Ajax interactions for rapid web development
  • 4.  Pre-defined library for jQery is downloadable in http://jquery.com/  Production version - this is for your live website because it has been minified and compressed  Development version - this is for testing and development (uncompressed and readable code)  The jQuery library is a single JavaScript file, and you reference it with the HTML <script> tag (notice that the <script> tag should be inside the <head> section): <head> <script src="jquery-1.11.0.min.js“ type=“text/javascript”></script> </head>  The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s). ◦ Basic syntax is: $(selector).action() ◦ A $ sign to define/access jQuery ◦ A (selector) to "query (or find)" HTML elements ◦ A jQuery action() to be performed on the element(s) ◦ E.g : - $("#test").hide() - hides the element with id="test“  If you don't want to download and host jQuery yourself, you can include it from a CDN (Content Delivery Network) Both Google and Microsoft host jQuery. ◦ Google <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> </head> ◦ Microsoft <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js"></script> </head>
  • 5.  Detecting When a Page has Loaded  Use $(document).ready() to detect when a page has loaded and is ready to use  Called once DOM hierarchy is loaded <script type="text/javascript"> $(document).ready(function(){ //Perform action here }); </script>
  • 6.  Select a element on page  Selectors can be basis of html Tags, ID or Class  Selector Syntax : $(selectorExpression) eg: $(‘div’).Action() To Select the specific tags use ,a $(‘div,p,span’) To select Descendants use space $(‘div span’) To select Tags by id prefix id with # $(‘#myDiv’) To select Tags by class prefix with class . $(‘.myClass’) Combine class with specific tag $(‘a.myClass’) Select by attribute, tag and attribute and specific attribute value, $(‘[title]’), $(‘div[title]’), $(‘[title=“MyTest”]’) and $(div[title=“MyTest”]’) Input Selectors $(‘:input’) select all input elements. $(‘:input’) :Contains – select elements that match the search $(‘div:contains(“C#”)’) :odd or :even – format the table rows $(‘tr:oddd’) or $(‘tr:even’) ^-Startwith $-Endswith *-contains stated value $(‘input[id$=“Name”]’)
  • 7.  Object Model – each element in the html is parsing as DOM.  jQuery provides set of function to interact the DOM. .each(function (index,element)) – is to iterate through jquery objects div.each(function(index,elem){ alert($(elem));}); this.propertyName=“value” is used to modify an object property directly $("div").each(function (i) {this.title = "My title " + I;}); .attr(attributeName) object attribute can be accessed Var title=$(‘#myDiv’).attr(“title”); .attr(attributeName,value) can modify the object attributes $(‘#myDiv’).attr(‘title’, ‘My New title’); .attr – modify multiple attributes pass json object contains name/value pairs $('#myDiv').attr({ title: 'My new Title‘, style: 'border:2px solid black;’ }); .css(key,value ) - Modifying styles and it can be passed as json object. $(‘div’).css(‘color’,’red’) Modifiying classes - .addClass(), .hasClass(), removeClass and toggleClass() $(‘#myDiv’).addClass(‘newClass’)
  • 8.  Events notify a program that a user performed some type of action  jQuery provides a cross-browser event model that works in IE, Chrome, Opera, FireFox, Safari and more  jQuery event model is simple to use and provides a compact syntax  click()  blur()  focus()  dblclick()  mousedown()  mouseup()  mouseover()  keydown(),  keypress() $(document).ready(function () { $('#clickButton').click(function () { alert($('#firstName').val()); }); }); Enter your name : <input type="text" id="firstName" /> <input type="button" id="clickButton" value="Click Me" /> <input type="button" id="clearButton" value="Clear" />
  • 9.  The on() function is a new replacement for the following: ◦ bind() ◦ delegate() ◦ live()  Multiple events and handlers can be defined in on() using a "map": $("#MyTable tr").on({ mouseenter: function(){ $(this).addClass("over"); }, mouseleave: function(){ $(this).removeClass("out"); } }); Hover events can be handled using hover(): $(selector).hover(hoverIn, hoverOut) $('div').on('click', function(){ alert('Clicked button!'); });
  • 10.  Ajax allow to make a call with out full page post back.  jQuery Ajax functions support cross-browser compatibility.  It supports Get and Post form actions  Load JSON, XML, HTML or even scripts.  jQuery provides several Ajax selectors cab be used to send and receive data. ◦ load(URL,data,callback)– Loads HTML data from the server ◦ $.get(URL,callback)- Requests data from a specified resource. The GET method may return cached data. ◦ $.post(URL,data,callback)– Submits data to be processed to a specified resource. It can also be used to get data, the POST method NEVER caches data, and is often used to send data along with the request. ◦ $.getJSON( url, data, callback ) – Get/Post and return JSON ◦ $.ajax( url [, settings ] ) – Provides core functionality