SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Events | DOM | Jquery CSS | Ajax
Event
• jQuery is tailor-made to respond to events in an HTML page.
• All the different visitor's actions that a web page can respond to are called
events.
• An event represents the precise moment when something happens.
• The term "fires" is often used with events.
• Example: "The keypress event fires the moment you press a key".
DOM Events
Mouse Events Keyboard Events Form Events
Document/Window
Events
click keypress submit load
dblclick keydown change resize
mouseenter keyup focus scroll
mouseleave blur unload
jQuery Syntax For Event Methods
• In jQuery, most DOM events have an equivalent jQuery method.
• To assign a click event to all paragraphs on a page, you can do this:
$("p").click();
• The next step is to define what should happen when the event fires.
You must pass a function to the event:
$("p").click(function(){
// action goes here!!
});
jQuery Event Methods
Method Description
bind() Attaches event handlers to elements
blur() Attaches/Triggers the blur event
change() Attaches/Triggers the change event
click() Attaches/Triggers the click event
dblclick() Attaches/Triggers the double click event
delegate() Attaches a handler to current, or future, specified
child elements of the matching elements
event.currentTarget The current DOM element within the event
bubbling phase
event.data Contains the optional data passed to an event
method when the current executing handler is
bound
event.delegateTarget Returns the element where the currently-called
jQuery event handler was attached
event.isDefaultPrevented() Returns whether event.preventDefault() was
called for the event object
event.isImmediatePropagationStopped() Returns whether
event.stopImmediatePropagation() was called
for the event object
event.isPropagationStopped() Returns whether event.stopPropagation() was
called for the event object
event.namespace Returns the namespace specified when the
event was triggered
jQuery Event Methods
event.pageX Returns the mouse position relative to the left
edge of the document
event.pageY Returns the mouse position relative to the top
edge of the document
event.preventDefault() Prevents the default action of the event
event.relatedTarget Returns which element being entered or exited
on mouse movement.
event.result Contains the last/previous value returned by an
event handler triggered by the specified event
event.stopImmediatePropagation() Prevents other event handlers from being called
event.stopPropagation() Prevents the event from bubbling up the DOM
tree, preventing any parent handlers from being
notified of the event
jQuery Event Methods
event.target Returns which DOM element triggered the
event
event.timeStamp Returns the number of milliseconds since
January 1, 1970, when the event is triggered
event.type Returns which event type was triggered
event.which Returns which keyboard key or mouse button
was pressed for the event
focus() Attaches/Triggers the focus event
jQuery Event Methods
focusin() Attaches an event handler to the focusin event
focusout() Attaches an event handler to the focusout event
hover() Attaches two event handlers to the hover event
keydown() Attaches/Triggers the keydown event
keypress() Attaches/Triggers the keypress event
keyup() Attaches/Triggers the keyup event
jQuery Event Methods
mousedown() Attaches/Triggers the mousedown event
mouseenter() Attaches/Triggers the mouseenter event
mouseleave() Attaches/Triggers the mouseleave event
mousemove() Attaches/Triggers the mousemove event
mouseout() Attaches/Triggers the mouseout event
mouseover() Attaches/Triggers the mouseover event
mouseup() Attaches/Triggers the mouseup event
jQuery Event Methods
off() Removes event handlers attached with the on() method
on() Attaches event handlers to elements
one() Adds one or more event handlers to selected elements. This handler can
only be triggered once per element
$.proxy() Takes an existing function and returns a new one with a particular
context
ready() Specifies a function to execute when the DOM is fully loaded
resize() Attaches/Triggers the resize event
scroll() Attaches/Triggers the scroll event
select() Attaches/Triggers the select event
submit() Attaches/Triggers the submit event
jQuery Event Methods
trigger() Triggers all events bound to the selected
elements
triggerHandler() Triggers all functions bound to a specified
event for the selected elements
unbind() Removes an added event handler from
selected elements
undelegate() Removes an event handler to selected
elements, now or in the future
jQuery Event Methods
CSS
• CSS stands for Cascading Style Sheets
• Styles define how to display HTML elements
• Styles were added to HTML 4.0 to solve a problem
• External Style Sheets can save a lot of work
• External Style Sheets are stored in CSS files
jQuery - Get and Set CSS Classes
• addClass() - Adds one or more classes to the selected elements
• removeClass() - Removes one or more classes from the selected
elements
• toggleClass() - Toggles between adding/removing classes from the
selected elements
jQuery - CSS style
<style type="text/css">
.important
{
font-weight:bold;
font-size:xx-large;
}
.blue
{
color:blue;
}
</style>
jQuery - css() Method
• The css() method sets or returns one or more style properties for the
selected elements.
css("propertyname"); - to get the value.
css("propertyname","value"); - to set the value.
css({"propertyname":"value","propertyname":"value",...}); - to set
multiple css properties.
jQuery - AJAX Introduction
• AJAX - art of exchanging data with a server, and updating parts of a web
page - without reloading the whole page.
• AJAX = Asynchronous JavaScript and XML.
• Ex: Gmail, Google Maps, Youtube, and Facebook tabs.
• Can request text, HTML, XML, or JSON from a remote server using both
HTTP Get and HTTP Post
• Can load the external data directly into the selected HTML elements of your
web page!
jQuery - AJAX load() Method
• load() - loads data from a server and puts the returned data into the selected
element.
$(selector).load(URL, data, callback);
• URL - specifies the URL you wish to load.
• data - specifies a set of query string key/value pairs to send along with the
request.
• callback - the name of a function to be executed after the load() method is
completed. The parameters are:
• responseTxt - contains the resulting content if the call succeed
• statusTxt - contains the status of the call
• xhr - contains the XMLHttpRequest object
jQuery - AJAX load() Method
jQuery - AJAX load() Method
jQuery - AJAX load() Method
jQuery - AJAX get() and post() Methods
• The jQuery get() and post() methods are used to request data from the
server with an HTTP GET or POST request.
• $.get() - requests data from the server with an HTTP GET request.
$.get(URL,callback);
• $.post() - requests data from the server using an HTTP POST request.
$.post(URL,data,callback);
jQuery - AJAX get() method
jQuery - AJAX post() method
HTTP Request: GET vs. POST
• GET - Requests data from a specified resource
• POST - Submits data to be processed to a specified resource
• GET is basically used for just getting (retrieving) some data from the
server. Note: The GET method may return cached data.
• POST can also be used to get some data from the server. However,
the POST method NEVER caches data, and is often used to send data
along with the request.
jQuery AJAX Methods
Method Description
$.ajax() Performs an async AJAX request
$.ajaxPrefilter() Handle custom Ajax options or modify existing options
before each request is sent and before they are
processed by $.ajax()
$.ajaxSetup() Sets the default values for future AJAX requests
$.ajaxTransport() Creates an object that handles the actual transmission
of Ajax data
$.get() Loads data from a server using an AJAX HTTP GET
request
$.getJSON() Loads JSON-encoded data from a server using a HTTP
GET request
$.getScript() Loads (and executes) a JavaScript from a server using
an AJAX HTTP GET request
jQuery AJAX Methods
$.param() Creates a serialized representation of an array or object (can be used
as URL query string for AJAX requests)
$.post() Loads data from a server using an AJAX HTTP POST request
ajaxComplete() Specifies a function to run when the AJAX request completes
ajaxError() Specifies a function to run when the AJAX request completes with an
error
ajaxSend() Specifies a function to run before the AJAX request is sent
ajaxStart() Specifies a function to run when the first AJAX request begins
ajaxStop() Specifies a function to run when all AJAX requests have completed
ajaxSuccess() Specifies a function to run when an AJAX request completes
successfully
load() Loads data from a server and puts the returned data into the selected
element
serialize() Encodes a set of form elements as a string for submission
serializeArray() Encodes a set of form elements as an array of names and values
Tech Mahindra 2013
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Deceptive simplicity of async and await
Deceptive simplicity of async and awaitDeceptive simplicity of async and await
Deceptive simplicity of async and awaitAndrei Marukovich
 
What the FUF?
What the FUF?What the FUF?
What the FUF?An Doan
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginnersIsfand yar Khan
 
Build Widgets
Build WidgetsBuild Widgets
Build Widgetsscottw
 
Event handling using jQuery
Event handling using jQueryEvent handling using jQuery
Event handling using jQueryIban Martinez
 
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesA (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesDavid Wengier
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY GOKUL SREE
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeMacoscope
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingJohn Ferguson Smart Limited
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2kshyju
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSMin Ming Lo
 

Was ist angesagt? (20)

Deceptive simplicity of async and await
Deceptive simplicity of async and awaitDeceptive simplicity of async and await
Deceptive simplicity of async and await
 
What the FUF?
What the FUF?What the FUF?
What the FUF?
 
jQuery Effects
jQuery EffectsjQuery Effects
jQuery Effects
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginners
 
Build Widgets
Build WidgetsBuild Widgets
Build Widgets
 
Event handling using jQuery
Event handling using jQueryEvent handling using jQuery
Event handling using jQuery
 
Digesting jQuery
Digesting jQueryDigesting jQuery
Digesting jQuery
 
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesA (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applications
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, Macoscope
 
jQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusionjQuery, CSS3 and ColdFusion
jQuery, CSS3 and ColdFusion
 
37c
37c37c
37c
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
 
JavaScript Libraries
JavaScript LibrariesJavaScript Libraries
JavaScript Libraries
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
 

Ähnlich wie J Query Presentation of David

jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginnersDivakar Gu
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerySeble Nigussie
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...Edureka!
 
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
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxAditiPawale1
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSRSolutions
 
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
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
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
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfRAVALCHIRAG1
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 

Ähnlich wie J Query Presentation of David (20)

jQuery
jQueryjQuery
jQuery
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...jQuery Tutorial For Beginners | Developing User Interface (UI) Using jQuery |...
jQuery Tutorial For Beginners | Developing User Interface (UI) Using 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
 
JQuery
JQueryJQuery
JQuery
 
J query
J queryJ query
J query
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONS
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
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 training
J query trainingJ query training
J query training
 
J query 01.07.2013.html
J query 01.07.2013.htmlJ query 01.07.2013.html
J query 01.07.2013.html
 
J query 01.07.2013
J query 01.07.2013J query 01.07.2013
J query 01.07.2013
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
Jquery
JqueryJquery
Jquery
 

Kürzlich hochgeladen

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
🐬 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
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 

Kürzlich hochgeladen (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 

J Query Presentation of David

  • 1. Events | DOM | Jquery CSS | Ajax
  • 2. Event • jQuery is tailor-made to respond to events in an HTML page. • All the different visitor's actions that a web page can respond to are called events. • An event represents the precise moment when something happens. • The term "fires" is often used with events. • Example: "The keypress event fires the moment you press a key".
  • 3. DOM Events Mouse Events Keyboard Events Form Events Document/Window Events click keypress submit load dblclick keydown change resize mouseenter keyup focus scroll mouseleave blur unload
  • 4. jQuery Syntax For Event Methods • In jQuery, most DOM events have an equivalent jQuery method. • To assign a click event to all paragraphs on a page, you can do this: $("p").click(); • The next step is to define what should happen when the event fires. You must pass a function to the event: $("p").click(function(){ // action goes here!! });
  • 5. jQuery Event Methods Method Description bind() Attaches event handlers to elements blur() Attaches/Triggers the blur event change() Attaches/Triggers the change event click() Attaches/Triggers the click event dblclick() Attaches/Triggers the double click event delegate() Attaches a handler to current, or future, specified child elements of the matching elements
  • 6. event.currentTarget The current DOM element within the event bubbling phase event.data Contains the optional data passed to an event method when the current executing handler is bound event.delegateTarget Returns the element where the currently-called jQuery event handler was attached event.isDefaultPrevented() Returns whether event.preventDefault() was called for the event object event.isImmediatePropagationStopped() Returns whether event.stopImmediatePropagation() was called for the event object event.isPropagationStopped() Returns whether event.stopPropagation() was called for the event object event.namespace Returns the namespace specified when the event was triggered jQuery Event Methods
  • 7. event.pageX Returns the mouse position relative to the left edge of the document event.pageY Returns the mouse position relative to the top edge of the document event.preventDefault() Prevents the default action of the event event.relatedTarget Returns which element being entered or exited on mouse movement. event.result Contains the last/previous value returned by an event handler triggered by the specified event event.stopImmediatePropagation() Prevents other event handlers from being called event.stopPropagation() Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event jQuery Event Methods
  • 8. event.target Returns which DOM element triggered the event event.timeStamp Returns the number of milliseconds since January 1, 1970, when the event is triggered event.type Returns which event type was triggered event.which Returns which keyboard key or mouse button was pressed for the event focus() Attaches/Triggers the focus event jQuery Event Methods
  • 9. focusin() Attaches an event handler to the focusin event focusout() Attaches an event handler to the focusout event hover() Attaches two event handlers to the hover event keydown() Attaches/Triggers the keydown event keypress() Attaches/Triggers the keypress event keyup() Attaches/Triggers the keyup event jQuery Event Methods
  • 10. mousedown() Attaches/Triggers the mousedown event mouseenter() Attaches/Triggers the mouseenter event mouseleave() Attaches/Triggers the mouseleave event mousemove() Attaches/Triggers the mousemove event mouseout() Attaches/Triggers the mouseout event mouseover() Attaches/Triggers the mouseover event mouseup() Attaches/Triggers the mouseup event jQuery Event Methods
  • 11. off() Removes event handlers attached with the on() method on() Attaches event handlers to elements one() Adds one or more event handlers to selected elements. This handler can only be triggered once per element $.proxy() Takes an existing function and returns a new one with a particular context ready() Specifies a function to execute when the DOM is fully loaded resize() Attaches/Triggers the resize event scroll() Attaches/Triggers the scroll event select() Attaches/Triggers the select event submit() Attaches/Triggers the submit event jQuery Event Methods
  • 12. trigger() Triggers all events bound to the selected elements triggerHandler() Triggers all functions bound to a specified event for the selected elements unbind() Removes an added event handler from selected elements undelegate() Removes an event handler to selected elements, now or in the future jQuery Event Methods
  • 13. CSS • CSS stands for Cascading Style Sheets • Styles define how to display HTML elements • Styles were added to HTML 4.0 to solve a problem • External Style Sheets can save a lot of work • External Style Sheets are stored in CSS files
  • 14. jQuery - Get and Set CSS Classes • addClass() - Adds one or more classes to the selected elements • removeClass() - Removes one or more classes from the selected elements • toggleClass() - Toggles between adding/removing classes from the selected elements
  • 15. jQuery - CSS style <style type="text/css"> .important { font-weight:bold; font-size:xx-large; } .blue { color:blue; } </style>
  • 16. jQuery - css() Method • The css() method sets or returns one or more style properties for the selected elements. css("propertyname"); - to get the value. css("propertyname","value"); - to set the value. css({"propertyname":"value","propertyname":"value",...}); - to set multiple css properties.
  • 17. jQuery - AJAX Introduction • AJAX - art of exchanging data with a server, and updating parts of a web page - without reloading the whole page. • AJAX = Asynchronous JavaScript and XML. • Ex: Gmail, Google Maps, Youtube, and Facebook tabs. • Can request text, HTML, XML, or JSON from a remote server using both HTTP Get and HTTP Post • Can load the external data directly into the selected HTML elements of your web page!
  • 18. jQuery - AJAX load() Method • load() - loads data from a server and puts the returned data into the selected element. $(selector).load(URL, data, callback); • URL - specifies the URL you wish to load. • data - specifies a set of query string key/value pairs to send along with the request. • callback - the name of a function to be executed after the load() method is completed. The parameters are: • responseTxt - contains the resulting content if the call succeed • statusTxt - contains the status of the call • xhr - contains the XMLHttpRequest object
  • 19. jQuery - AJAX load() Method
  • 20. jQuery - AJAX load() Method
  • 21. jQuery - AJAX load() Method
  • 22. jQuery - AJAX get() and post() Methods • The jQuery get() and post() methods are used to request data from the server with an HTTP GET or POST request. • $.get() - requests data from the server with an HTTP GET request. $.get(URL,callback); • $.post() - requests data from the server using an HTTP POST request. $.post(URL,data,callback);
  • 23. jQuery - AJAX get() method
  • 24. jQuery - AJAX post() method
  • 25. HTTP Request: GET vs. POST • GET - Requests data from a specified resource • POST - Submits data to be processed to a specified resource • GET is basically used for just getting (retrieving) some data from the server. Note: The GET method may return cached data. • POST can also be used to get some data from the server. However, the POST method NEVER caches data, and is often used to send data along with the request.
  • 26. jQuery AJAX Methods Method Description $.ajax() Performs an async AJAX request $.ajaxPrefilter() Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax() $.ajaxSetup() Sets the default values for future AJAX requests $.ajaxTransport() Creates an object that handles the actual transmission of Ajax data $.get() Loads data from a server using an AJAX HTTP GET request $.getJSON() Loads JSON-encoded data from a server using a HTTP GET request $.getScript() Loads (and executes) a JavaScript from a server using an AJAX HTTP GET request
  • 27. jQuery AJAX Methods $.param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests) $.post() Loads data from a server using an AJAX HTTP POST request ajaxComplete() Specifies a function to run when the AJAX request completes ajaxError() Specifies a function to run when the AJAX request completes with an error ajaxSend() Specifies a function to run before the AJAX request is sent ajaxStart() Specifies a function to run when the first AJAX request begins ajaxStop() Specifies a function to run when all AJAX requests have completed ajaxSuccess() Specifies a function to run when an AJAX request completes successfully load() Loads data from a server and puts the returned data into the selected element serialize() Encodes a set of form elements as a string for submission serializeArray() Encodes a set of form elements as an array of names and values