jQuery Mobile 'return false' on form submission -
i have form on jquery mobile site validate, , stop submission if validation not pass.
however, 'return false' not stop form being submitted, because jquery mobile submitting form via ajax. how can stop form submission?
$("#form").live('submit', function(){ alert('test'); return false; });
the above code fires alert, not stop form being submitted. if use data-ajax="false" on form tag works correctly, rather use ajax submission if possible.
use data-ajax="false"
, bind own ajax form submission code runs if validation passes:
$("#form").live('submit', function() { if (formvalidates) { $.post(...); } return false; });
Comments
Post a Comment