19
linuxxx
5y

Started development on a Firefox addon again:

Adding an onclick HTML tag/property (however you call that) - doesn't fire at all.

Adding an event listener - says no elements with the class I'm using (checked, it's correct) exist, doesn't fire.

Well, fucking great 😐

Comments
  • 1
    Make sure the events are added when the dom is built. Either in an document loaded event as @jespersh mentioned, or in a script tag at the end of the body. I think the easiest way to achieve first method is by adding a function call to the onlaod attribute of the body tag.
  • 0
    make sure your script is not running in the wrong iframe
  • 2
    Be sure not to add () or your function call turns from a function call into its return value
  • 0
    I did a workaround and that works now (better option in the end anyways).

    Now stuck on cancelling requests, no matter what I do (tested enough to know that it DOES reach that code), it doesn't cancel the requests I want it to cancel 😣
Add Comment