I have the following HTML code and I'm trying to make a JavaScript to click on this button
<fieldset class="fields1"></fieldset>
<fieldset class="submit-buttons">
<some other button here >
<input class="button1" type="submit" value="Submit" name="post" tabindex="4" accesskey="f"></input>
I tried the following lines of code neither of which works:
$(".submit-buttons").children('input[name="post"]').click();
$("input[name=post]").click();
Is there any other way to click the button1? And is there a way to select the button by its tabindex or accesskey?
The click function is for event handling not triggering events. If you want to trigger a click use trigger
$("input[name=post]").trigger('click');