Category "addeventlistener"

How to check if a key is pressed/held down using event listeners and hooks in React Native?

If I need to know whether a key like the shift key is currently being pressed, how can I find that info? This solution should assign this info into a single var

window.dispatchEvent from test code does not trigger window.addEventListener

I have below listener added for which I am trying to write test using Jest. However, it seems as though the event I'm dispatching doesn't reach my code. window.

why not get expected result by the addEventListener method in javascript

output is "PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}",it is not expected the expected result is "li".please help,

Javascript adding a new event listener on local object

I have a script below, where I dynamically create an Element Node of type 'li'. This addMovieHandler() is called whenever the user clicks on a button. Additiona

Why is my page not loading when clicking on event listener?

I'm creating an anime quiz. So when the user clicks on "Welcome to the anime quiz" s/he should be presented with 4 different anime titles. However, nothing happ

e.preventDefault() not working in 100% cases

I'm trying to disable every click events on a web pages. document.addEventListener("click", function (e) { e.preventDefault(); e.stopImmediatePropag

To merge window resizing and loading the page events into one function

I have a local html page that serves me a cheat sheet about how width, max-width and min-width work. It dynamically reports you the width of the body and of the

How to return value from addEventListener

I use Javascript to catch the x and y position for when user clicks a link. I can make it work, but I want it to return the two values to function init() when i

Google Maps API v3 binding events to multiple maps

I've got a page with two Google maps on, using the v3 API. Currently they have one pin each, with the same lat & long set for each pin, although one of the

Code inside DOMContentLoaded event not working

I have used <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> </head> <body> <button type="button" id="button"&

HTML5 Video - Pause when get to middle of video

Aim: video clip is in 2 parts: first half of content is the playing forwards, the second half is the first half in reverse. The video plays when mouseover and w

How to attach a keyup event to Custom Element shadowRoot

I have searched for some time; but only find Polymer answers; or answers where EventListeners are put on DOM elements inside the shadowRoot. The effect I am try

JavaScript, for each hover over change the text color

I have 4 div (colored box) and each div represent a different color. When a user hovers over one of the colored boxes the text to display ("Hello world") should

How to add event Listeners in Angular?

I am writing an app using Angular 6, trying yo listen to plotly_click events (Visualization library). How can i set up a listener? The Angular is recommendin