samedi 29 mars 2014

JQuery .on() to prevent submission of a dynamically created form


Vote count:

0




All of the forms in my web application require validation before they are submitted. This code is doing the job properly:



$(document).on("submit",'form',function(){
// loop through $(this) and check each .required field and increment a counter
// if counter > 0 then return false
});


However the validation is not triggered when I submit a form that was added to the DOM after the page loaded.


I am not getting any errors in my console log (with 'Preserve log upon navigation' on).


To date, the .on() event has worked correctly on dynamically created elements but this one has me stumped.


Any ideas?



asked 56 secs ago






Aucun commentaire:

Enregistrer un commentaire