havvg's playground

Developing Software is Fun!

enable submit event on live bindings in jQuery

Toni Uebernickel

The live() method is one great new feature of jQuery 1.3, however it does not support binding of the event ‘submit’ of forms.

$('form').live('submit', function() {
  // your callback
});

This can be simulated by a simple workaround on the selected objects. The click() event can be bound using the live() method. The workaround is simple: do not bind the submit of a form, but the click on any submit button within it.

$('input:submit', $('form')).live('click', function() {
  // your callback
});
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 © 2017 • All rights reserved.