jquery - Submit with javascript -
how can specify submit button submit with?
the current example submits first submit button, $("form").submit(); how can make chooses submit button id or name?
<html> <script> $("form").submit(); </script> <form action="<?=$_server['php_self']?>" method="post" /> //other inputs <input type="submit" value="enter" name="enter" id="enter"> <input type="submit" value="void" name="void" id="void"> <input type="submit" value="refund" name="refund" id="refund"> </form> </html>
by id
you can select element id $('#my_btn')
, can click on using jquery method click()
.
by name (or other attribute
other attributes bit harded (but not complex) select element $('input[name=some_name]')
examlpe using code
here example shows how can elements name , click on them, click submit buttons see happens: http://jsfiddle.net/nabil_kadimi/99v93/2/
Comments
Post a Comment