html - Javascript trigger submit button -
this question has answer here:
i tried googled nothing helped me.
want trigger following button:
<input class="btn btn_large btn_green" value="go" type="submit">
if element id work charm:
document.getelementbyid('btn btn_large btn_green').submit();
but since can't assign id button isn't working.
if try call via
document.getelementsbyclassname("").submit();
it isn't working.
thanks in advance
you can try document.queryselector():
you can select class using "." , click element submit.
var button = document.queryselector('.btn.btn_large.btn_green'); console.log(button); button.click();
<input class="btn btn_large btn_green" value="go" type="submit">
Comments
Post a Comment