0

I know, with jQuery, it is possible to check a checkbox, but us it possible to submit a form. Not handle the submission / submitted data, but simulate the submit button being clicked— or if possible the enter / return key being pressed?

4 Answers 4

2

Yes, it is possible, and you don't even need the button:

$("form").submit(); 
Sign up to request clarification or add additional context in comments.

Comments

0
$('#submit_btn_id').click(function() { $('#form_id').submit(); }); 

Comments

0

If you have the submit button then you can emulate by using trigger in some other event's code.

 $('#submit_button_id').trigger('click'); 

Comments

0

Of course but you need to specify an even at which you want to simulate the action . I suppose that you want it to be the press of enter key .. the code will be

$(document).keypress(function(e){ if (e.which == 13){ $("#submit").trigger('click'); } }); $("#submit").click(function(){ // do your stuff }) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.