I have a two or more forms on my page in a row.
I’m trying to hook submit event like:
$('form',someObj).submit(function(e){
/* Do some stuff with ajax */
return false;
});
But always receive events only from a first (by code) form.
Also used each() function to bind event for each object, same thing..
What’s wrong?
Thanks!
If
someObjcontains both forms this will work, however if you just want to attach to the only two forms in the page, leave the context off the selector, like this:This will search for all forms in the document, alternatively, search for forms via a class or ID, like this: