We build your ideas. Contact us for Mobile/Web App Development. Write us @ contact@milanjeet.com

Trigger jQuery Multiple events with one function.

jquery multiple events

What is jQuery ?

jQuery is a cross-platform, fast, small, and feature-rich JavaScript library created by John Resig in 2006. jQuery is designed to simplify the client-side scripting of HTML. With an easy-to-use API, it makes HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across multiple browsers. Going through a jQuery Tutorial will make you strong in coding and capable of writing business logic in a Developer way.

jQuery Events

An event is a response of a visitor’s action from the website. Visitor on a website do multiple actions like moving mouse around, clicking on the useful menu on the webpage or use the keyboard for writing useful or required information needed by the website. Some re-action is performed from the website,  this re-action is known as event.

jQuery has a lot events. These events are very useful to interact with user. Events provide soft look and wow feel on the Web. By playing with jQuery form events the visitor using these events, required information can be collected and still visitor say, “Wow”.

Multiple jQuery Events

  • Browser events
  • Document events
  • Document handler attachement
  • Form events
  • Keyboard events
  • Mouse events
  • Event objects

 

Trigger jQuery Multiple events with one function.

jQuery multiple events can be triggered with multiple way. One is the mostly used solution is

$('#element').on('event1 event2 event3 event..n', function(e) {
    // e.type is the type of event fired
});

 

or we can also achieve as below

 

$("element").event1(function1)
  .event2(function2)
  .event3(function3)
  .event..n(function..n);

 


Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)