I have a chrome extension with content_scripts
. When page loads i'm appending new element to DOM
using jquery:
urlTarget.parent().prepend("<div class='scout status' onClick='test()' data-domain='" + domainKey + "'></div>");
This works fine. I also defined a function inside my inject.js
content script:
function test() {
alert("this is test");
return false;
}
After clicking appended element i get following error:
Uncaught ReferenceError: test is not defined
I've been reading about security restrictions in chrome extension framework (see docs), but i'm not sure if they are applied to content script also (documentation shows popup example), or am i am missing something else?