Window.onclick
i have this weird issue where window.onclick is not triggering
my code looks something like this
16 Replies
I'm guessing maybe "something like" isn't quite close enough cause that works as expected
yes its working fine on code pen, not sure why not working on my project
is this the exact code in your project?
yes same structure
it's
stopPropagation
with a capital Pstill not woking
exact same code btw 🤣
well, when I put stoppropagation in the codepen, I got a console error. Do you get any errors in your console?
no actually its not triggering only
then there's not much we can do without a running example that shows the problem
it's likely a syntax error somewhere. That
stopPropagation
thing definitely is one, but if there's others the method might not be getting added
I can't spot one in your screenshot, but I'm also not a javascript engine so I might be missing somethingok
there's tips in #how-to-ask-good-questions for sharing your code
can't share the whole project here, so shared a small part
when you only share a part, you have to make sure the problem still exists though 🙂
it's like taking your friend's car to the mechanic and saying "mine doens't work, fix it please"
yes, i get it
well, its working fine with window,addEventListener
anyway thanks for your time ✌️