JQuery - mock click button does not call function

Good,

So, I used firebug as well as some extensions I wrote to create shortcuts on a website that I use a lot. There, on the fact that I don't understand why it doesn't work or why it's not possible:

Sample code:

<input type="button" onclick="addNewRow()" id="addRow"/>
//This will add a new row to the current table.
//The function is defined by the website (not my function)

      

When using firebug:

jQuery("#addRow").click();
//This will simulate the button click, and will automatically add the new row.

      

When using google chrome extension:

jQuery("#addRow").click();
//It doesn't add the new row.

      

Why can't the extension execute the function after the button is pressed, and why does firebug have no problem on startup?

This is normal? Is this a safety feature? or am I doing something wrong?

I know that I cannot access the existing functionality on the website for security reasons, but why doesn't fake the button launch it for me?

+3


source to share


3 answers


Try:



jQuery("#addRow").trigger("click");

      

+2


source


Which version of Chrome are you using? There is a new protection feature Chrome Extensions that blocks inline javascript. You can read more here: http://browserfame.com/512/chrome-extension-content-security-policy



+1


source


On chrome, I would rather use the WebKit developer console over the firebug extension.

0


source







All Articles