javascript - how do i stop a form submit with jQuery -


i have form here , dont want them go next page without selections

<form method="post" action="step2/" id="form1"> .... .... .... <input type="submit" class="submit notext" value="next" /> 

and here jquery

$('.submit').click(function(e) {     var business = $(".business_type_select").find('.container strong').text();     alert(business);     if(business == "select business type"){         alert("businessbusinessbusiness");         e.preventdefault;         return false;     } }); 

any ideas missing stop submitting

try using submit event:

$("#formid").submit(function(e) {     var business = $(".business_type_select").find('.container strong').text();     alert(business);     if(business == "select business type"){         alert("businessbusinessbusiness");         return false;     } }); 

also, e.preventdefault() function, redundant return false work same.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -