Tell me, please, how to use a javascript button to call a button ?.
For example, there is a button:

<input type="submit" id="myButton" onclick="myFunc()" > 

I need, with the help of JavaScript or jQuery, to call it click. And at the same time, to trigger the onclick event

    2 answers 2

    $ ('# myButton'). click ();

    • Thanks, I'll try tomorrow. - Anton Mukhin

    the click () method will only work in FF

    if you just need to call the event handler myFunc (), without causing the event itself (and other handlers), then you should use something like

     if($('#myButton').onclick()!==false) { $('#myButton').submit(); }