javascript - How to apply form onSubmit on one submit type only? -
i have html form on submit calls validation method. now, in form have 2 submit types:
<input type="submit" name="abc" value="abc">
<input type="submit" name="xyz" value="xyz">
now, when click on submit button validation method called. want call validation method when 'abc' button clicked , not when 'xyz' clicked.
is there way using javascript handle this?
if want validate form on 1 submit button on form submit
$('form').submit(function(event) { var btn = event.originalevent.explicitoriginaltarget.value; if (btn === 'abc') { alert('true'); } else { alert('false'); } });
Comments
Post a Comment