havvg's playground

Developing Software is Fun!

triggerHandler on live event bindings in jQuery

Toni Uebernickel

As stated in the jQuery API Documentation, the triggerHandler() method does not work on events bound to objects using the live() method, which includes also objects created after the DOM was loaded completely.

However, this is nothing unusual. In fact, it might be a common way to work within an advanced AJAX enabled webapplication. I encountered this problem this evening and also created a simple workaround. The following code snippet works just fine.

var event = new $.Event('click');
event.preventDefault();
$('input:submit', $(this)).trigger(event);
blog comments powered by Disqus
Written by

Toni Uebernickel

Software Engineer and Architect, Symfony evangelist with some Ducati bikes.

Support & Share
You should subscribe to my feed!
All content copyright Toni Uebernickel © 2018 • All rights reserved.