0

How to convert this code below into Jquery?

document.getElementsByName("autosubmit")[0].click(); // SUBMIT FORM

It should look like this code below.

$("#dateForm").submit();

Element Name is from <input type="submit" name="autosubmit">

Any help please.

4 Answers 4

2

Give your form an id and submit with:

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

Comments

0

You can use Attribute Equals Selector [name="value"]

$('input[type="submit"][name="autosubmit"]').trigger('click');

OR

If you have multiple elements with name=autosubmit you can use :first selector

$('input[type="submit"][name="autosubmit"]:first').trigger('click');

As per comment

setTimeout(function(){
    $('input[type="submit"][name="autosubmit"]').trigger('click');
}, 2000);

3 Comments

you can just use $('input[name="autosubmit"]').trigger('click');
@satpal How to set the timer before the trigger? I want to delay the trigger for just a 2 seconds.
@user3097736, Use setTimeout(function(){ $('input[type="submit"][name="autosubmit"]').trigger('click'); }, 2000);
0

try

$("input[name='autosubmit']").submit();

Comments

0

Try this code below:

$('input[name=autosubmit]:eq(0)').click();

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.