SlideShare una empresa de Scribd logo
1 de 16
Prepared by:
 Ahmed EL-Harouny
Senior Software Engineer
1.        Handling Events
     1.    Binding To Events
     2.    Event Object
     3.    Binding Shortcuts
     4.    Manually Trigger Events
     5.    Keyboard Events
     6.    Unbind Events
     7.    The Live() function
2.        Ajax
     1.    load() – the simplest
     2.    jQuery.ajax() – the giant
     3.    Json and Jsonp
     4.    Twitter demo!
3.        Build a plugin Demo
Bind() function: attach a handler to an event for the elements.




Multiple Handlers

When an event reaches an element, all handlers bound to that event type for
the element are fired. If there are multiple handlers registered, they will
always execute in the order in which they were bound. After all handlers have
executed, the event continues along the normal event propagation path.
event object: an object that contains information and functionality related to
the current event is passed to all event handlers:
Most DOM events exists as functions for short
• click()
• change()
• mousedown(), mouseenter(), mouseleave(), mousemove() …etc
• ready()
• scroll()
trigger() function: Execute all handlers and behaviors attached to the
matched elements for the given event type.




Shortcut functions can also be used for triggering events:
keyup(): The keyup event is sent to an element when the user releases a key
on the keyboard.




keydown (): The keydown event is sent to an element when the user first
presses a key on the keyboard.

Note: keyboard events are only triggered on elements that have focus.
unbind() function: Remove a previously-attached event handler from the
elements.
live() function: Attach an event handler for all elements which match the
 current selector, now and in the future.




Note: #thirdBtn don’t exist on the page yet.
load() function: Load data from the server and place the returned HTML
into the matched element.




Also takes those optional parameters:
[, data] [, complete(responseText, textStatus, XMLHttpRequest)]
jQuery.ajax() function: Perform an asynchronous HTTP (Ajax) request.
Reference: http://api.jquery.com/jQuery.ajax/
   Json
    JavaScript Object Notation, is a lightweight text-based open
    standard designed for human-readable data interchange.

    Despite its relationship to JavaScript, it is language-
    independent, with parsers available for many languages.
Jason Format:
   Jsonp
    JSONP or "JSON with padding" is a complement to the base
    JSON data format. It provides a method to request data from
    a server in a different domain, something prohibited by
    typical web browsers because of the same origin policy.
Demo
Demo
http://harouny.wordpress.com/2012/06/06/make-your-first-
jquery-plugin-in-2-minutes/

Más contenido relacionado

La actualidad más candente

Part 6 filter using table record in vb.net
Part 6 filter using table record in vb.netPart 6 filter using table record in vb.net
Part 6 filter using table record in vb.net
Girija Muscut
 
Part 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.netPart 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.net
Girija Muscut
 

La actualidad más candente (20)

React js use contexts and useContext hook
React js use contexts and useContext hookReact js use contexts and useContext hook
React js use contexts and useContext hook
 
Part 6 filter using table record in vb.net
Part 6 filter using table record in vb.netPart 6 filter using table record in vb.net
Part 6 filter using table record in vb.net
 
Part 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.netPart 7 navigating through recordset in vb.net
Part 7 navigating through recordset in vb.net
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom event
 
React.js+Redux Workshops
React.js+Redux WorkshopsReact.js+Redux Workshops
React.js+Redux Workshops
 
Html5 events
Html5 eventsHtml5 events
Html5 events
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디
 
Examplecode
ExamplecodeExamplecode
Examplecode
 
Realm database
Realm databaseRealm database
Realm database
 
Android rest client applications-services approach @Droidcon Bucharest 2012
Android rest client applications-services approach @Droidcon Bucharest 2012Android rest client applications-services approach @Droidcon Bucharest 2012
Android rest client applications-services approach @Droidcon Bucharest 2012
 
Dot net technology
Dot net technologyDot net technology
Dot net technology
 
Timothy N. Tsvetkov, Rails 3.1
Timothy N. Tsvetkov, Rails 3.1Timothy N. Tsvetkov, Rails 3.1
Timothy N. Tsvetkov, Rails 3.1
 
Vuex: X factor for Vue
Vuex: X factor for VueVuex: X factor for Vue
Vuex: X factor for Vue
 
Guava’s Event Bus
Guava’s Event BusGuava’s Event Bus
Guava’s Event Bus
 
Asynchronous and event-driven Grails applications
Asynchronous and event-driven Grails applicationsAsynchronous and event-driven Grails applications
Asynchronous and event-driven Grails applications
 
Infinum Android Talks #02 - EventBus
Infinum Android Talks #02 - EventBusInfinum Android Talks #02 - EventBus
Infinum Android Talks #02 - EventBus
 
GreenRobot-Eventbus
GreenRobot-EventbusGreenRobot-Eventbus
GreenRobot-Eventbus
 
Ext Js Events
Ext Js EventsExt Js Events
Ext Js Events
 
JS Fest 2018. Martin Chaov. SSE vs WebSockets vs Long Polling
JS Fest 2018. Martin Chaov. SSE vs WebSockets vs Long PollingJS Fest 2018. Martin Chaov. SSE vs WebSockets vs Long Polling
JS Fest 2018. Martin Chaov. SSE vs WebSockets vs Long Polling
 
Modern Web Apps Development 101
Modern Web Apps Development 101Modern Web Apps Development 101
Modern Web Apps Development 101
 

Similar a Advanced Jquery

Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
kshyju
 
13. session 13 introduction to dhtml
13. session 13   introduction to dhtml13. session 13   introduction to dhtml
13. session 13 introduction to dhtml
Phúc Đỗ
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
Faisal Aziz
 

Similar a Advanced Jquery (20)

J Query Presentation of David
J Query Presentation of DavidJ Query Presentation of David
J Query Presentation of David
 
Event handling
Event handlingEvent handling
Event handling
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
 
13. session 13 introduction to dhtml
13. session 13   introduction to dhtml13. session 13   introduction to dhtml
13. session 13 introduction to dhtml
 
Javascript #8 : événements
Javascript #8 : événementsJavascript #8 : événements
Javascript #8 : événements
 
event handling new.ppt
event handling new.pptevent handling new.ppt
event handling new.ppt
 
Event Handling in Java
Event Handling in JavaEvent Handling in Java
Event Handling in Java
 
Javascript Browser Events.pdf
Javascript Browser Events.pdfJavascript Browser Events.pdf
Javascript Browser Events.pdf
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
 
JavaScript_Events.pptx
JavaScript_Events.pptxJavaScript_Events.pptx
JavaScript_Events.pptx
 
Event Handling in JAVA
Event Handling in JAVAEvent Handling in JAVA
Event Handling in JAVA
 
What is Event
What is EventWhat is Event
What is Event
 
Advance Java Programming(CM5I) Event handling
Advance Java Programming(CM5I) Event handlingAdvance Java Programming(CM5I) Event handling
Advance Java Programming(CM5I) Event handling
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
09events
09events09events
09events
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
 
16 18
16 1816 18
16 18
 
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing ButtonsJAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
 
Chap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptxChap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptx
 
Lesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFLesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPF
 

Más de Ahmed Elharouny

Más de Ahmed Elharouny (7)

Deep dive into azure durable functions
Deep dive into azure durable functionsDeep dive into azure durable functions
Deep dive into azure durable functions
 
Applying microservices principles to front end
Applying microservices principles to front endApplying microservices principles to front end
Applying microservices principles to front end
 
NoSQL, which way to go?
NoSQL, which way to go?NoSQL, which way to go?
NoSQL, which way to go?
 
Introduction to require js
Introduction to require jsIntroduction to require js
Introduction to require js
 
Building share point apps with angularjs
Building share point apps with angularjsBuilding share point apps with angularjs
Building share point apps with angularjs
 
Introduction to AngularJs
Introduction to AngularJsIntroduction to AngularJs
Introduction to AngularJs
 
Design patterns
Design patternsDesign patterns
Design patterns
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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?
 
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 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
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Advanced Jquery

  • 1. Prepared by: Ahmed EL-Harouny Senior Software Engineer
  • 2. 1. Handling Events 1. Binding To Events 2. Event Object 3. Binding Shortcuts 4. Manually Trigger Events 5. Keyboard Events 6. Unbind Events 7. The Live() function 2. Ajax 1. load() – the simplest 2. jQuery.ajax() – the giant 3. Json and Jsonp 4. Twitter demo! 3. Build a plugin Demo
  • 3. Bind() function: attach a handler to an event for the elements. Multiple Handlers When an event reaches an element, all handlers bound to that event type for the element are fired. If there are multiple handlers registered, they will always execute in the order in which they were bound. After all handlers have executed, the event continues along the normal event propagation path.
  • 4. event object: an object that contains information and functionality related to the current event is passed to all event handlers:
  • 5. Most DOM events exists as functions for short • click() • change() • mousedown(), mouseenter(), mouseleave(), mousemove() …etc • ready() • scroll()
  • 6. trigger() function: Execute all handlers and behaviors attached to the matched elements for the given event type. Shortcut functions can also be used for triggering events:
  • 7. keyup(): The keyup event is sent to an element when the user releases a key on the keyboard. keydown (): The keydown event is sent to an element when the user first presses a key on the keyboard. Note: keyboard events are only triggered on elements that have focus.
  • 8. unbind() function: Remove a previously-attached event handler from the elements.
  • 9. live() function: Attach an event handler for all elements which match the current selector, now and in the future. Note: #thirdBtn don’t exist on the page yet.
  • 10. load() function: Load data from the server and place the returned HTML into the matched element. Also takes those optional parameters: [, data] [, complete(responseText, textStatus, XMLHttpRequest)]
  • 11. jQuery.ajax() function: Perform an asynchronous HTTP (Ajax) request. Reference: http://api.jquery.com/jQuery.ajax/
  • 12. Json JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. Despite its relationship to JavaScript, it is language- independent, with parsers available for many languages.
  • 14. Jsonp JSONP or "JSON with padding" is a complement to the base JSON data format. It provides a method to request data from a server in a different domain, something prohibited by typical web browsers because of the same origin policy.
  • 15. Demo