Skip to content

Tag: dom-events

Javascript Won’t replace image

My Js code below is a quiz game. Each question takes up a full page, which means we have to change all the content every time the user presses the next button. My issue is, i can’t seem to get the image to switch to the next by fully replacing it. In my case the new images just go to

How to pass “this” and another variable in EventListener?

I have a function in my addEventListener (#btn-1) that I want to remove eventually. I know that saving the function to a variable is the way to do it, but passing the “this” won’t work unless it’s wrapped in a function, which in turn won’t be able to be removed now because it’s either an anonymous function or it’s not

Should the HTML element dispatch `beforeinput` events?

The MDN page for beforeinput states that: The DOM beforeinput event fires when the value of an <input>, <select>, or <textarea> element is about to be modified <select> is clearly mentioned as supporting the beforeinput event. This also seems to be true based on my simple reading of the spec: Trusted Targets: Element (specifically: control types such as HTMLInputElement, etc.)