I know similar questions have been asked many times, but I didn\'t find a solution for mine yet. My question is really simple. All I want to do is to test actions on popup.html,
The problem is that your code executes as soon as tag is read, i.e. before your element exists in DOM.
Wrap it in $(document).ready()
and you're good to go:
$(document).ready(function() {
/* your code */
});
For a non-jQuery solution, wrap it in DOMContentLoaded
listener:
document.addEventListener("DOMContentLoaded", function() {
/* your code */
});
Finally, you can simply move the tag to the end of
, but it's a less robust solution.