Click Event Never Called (but copy/paste works) in Content Script
I'm writing a very simple chrome extension, and I can't seem to get a
click event to work.
This is the part of the script I'm having trouble with. I tried the native
addEventListener, and the jQuery version.
var $btn = $('<button>');
$btn.text(fix.name);
$btn.appendTo($buttonContainer);
$btn.on("click", function() {
alert("abc");
}
Preemptive Q&A:
Is this code ever reached?
This code is being reached, tested by alerts and the fact that I can see
the button. Is there some difference between normal JavaScript and chrome
extensions that would cause this?
Are there any errors in your console?
I don't have any errors in my console. jQuery is included in my content
scripts, and is apparently existent, based on the buttons showing up.
What does this have to do with chrome extensions?
I believe it's a difference between a usual script, and a content script
because I can copy and paste my entire content script into the developer
console, and it works as expected.
Where's the rest of the code?
The entire code may be found on PasteBin, and the CoffeeScript source.
I'll update the question later if I didn't include a relevant portion of
the code.
What Chrome version?
29.0.1547.49 beta.
What about...?
Please ask :-)
No comments:
Post a Comment