I have this js function in my html code of a webpage.
function update() {
document.getElementById( "textbox ").value = updatetext;
}
When I execute "update ()" from the Chrome console, it works.
But if I do the chrome extension,
chrome.tabs.executeScript(tab.id, {code: "update();"}, function(result){});
It says that the update is undefined. But if I replace with "alert (" ok "), it works.
Then I do
eval("update()")
in the contents of the Chrome script extension. It also states that "the update is undefined."
So what can I do to call the js function on a web page?
source
share