Chrome Script Extension Content Creation Not Defined
I write Chrome script content and when I inject it into the DOM:
"<a href='#' onclick='alert(\"Hi!\");return false;'>Hi</a>"
it works fine (a warning appears when I click it), however, if I create a function for the warning, it will say the function is undefined. Example:
"<a href='#' onclick='alertPlease(\"Hi!\");return false;'>Hi</a>"
function alertPlease(x){
alert(x);
}
All my code is the same contents of the script js file.
Should I post any code that can be used after loading into another js file in the background? I tried adding a wallpaper with 'alertPlease ();' functions, but that didn't work either.
Any hint would be greatly appreciated!
Thank!