How to write JavaScript snippets in Firebug to click on a button

1) If the name of the button is given and if it is inside a form then the following would work:

formName.buttonName.click();

2) If the name of the button is given and it is NOT inside a form then:

buttonName.click();

3) If there is only one button and the type is submit(in which case there will only be one button) then:

document.formName.submit();

else

document.formName.buttonName.click();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s