jquery - Hot to re-active preventDefault function in javascript -
when user clicked on submit button, need check validations before submition. if entered data not valid page should not submit.
$(document).ready(function() { $("#colomnchange").submit(function(e) { var testa = 1; if (testa == 1) { testa = 2; //e.preventdefault(); return false; } else { return true; } }); }); i can stop submition using priventdefault function in js. again user clicked on submit button after correct wrong data, page should submit well. how can re-active default function.
the answer is: go first if (because set variable 1 check if equals 1, true) change testa = 1 testa = 2 , event go else not have preventdefault() method event carry on
Comments
Post a Comment