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');   } }); 

demo - fiddle


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -