addEventListener in jQuery

Diana picture Diana · Aug 11, 2011 · Viewed 68.4k times · Source

Possible Duplicate:
jQuery equivalent of JavaScript's addEventListener method

Also from a very good jQuery tutorial on : http://itunes.apple.com/in/app/designmobileweb/id486198804?mt=8

What is the jQuery equivalent for the following statement;

element1.addEventListener('click',doSomething2,false)

If it is the bind() method, is there any option to specify the last parameter (i.e. event bubbling or capturing ...true/false)

Thank you.

Answer

ShankarSangoli picture ShankarSangoli · Aug 11, 2011

Try this

// Setting the third argument to false will attach a function
// that prevents the default action from occurring and 
// stops the event from bubbling.
$("#element1").bind("click", doSomething2, false);