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
Post a Comment