addeventlistener Questions
15
Solved
Is there anyway to remove an event listener added like this:
element.addEventListener(event, function(){/* do work here */}, false);
Without replacing the element?
Overhang asked 24/6, 2010 at 1:4
4
Solved
I'm making use of matchMedia().addListener to detect dark/light mode theme preference changes in Safari, however in WebStorm using addListener is marked as deprecated but simply says to refer to do...
Cablet asked 5/6, 2019 at 18:39
9
Solved
Just something I've been wondering. In the second parameter in the .addEventListener method, can you call a "(custom) class method" instead of a function?
i.e Would something like the following w...
Alyssaalyssum asked 23/1, 2014 at 3:43
7
I am working on React native project and there I am taking location permissions. Also I have to track location permissions always like if user has given permission access after install the applicat...
Cristinacristine asked 13/11, 2019 at 7:44
16
Solved
I've created an object that has several methods. Some of these methods are asynchronous and thus I want to use events to be able to perform actions when the methods are done. To do this I tried to ...
Margeret asked 30/12, 2013 at 8:13
11
Solved
While working with browser events, I've started incorporating Safari's touchEvents for mobile devices. I find that addEventListeners are stacking up with conditionals. This project can't use JQuery...
Johnathan asked 10/1, 2012 at 0:15
6
Solved
I have a set of items like this:
<label for="Cadenza-1" class="cars">
<input type="checkbox" value="1" alt="Cadenza" id="Cadenza-1" name="vehicles[]">
<img src="img/bill_murray_17...
Sihonn asked 6/4, 2016 at 20:37
4
Solved
I have the following code:
document.querySelector('.mySelector').addEventListener("mouseover", function() {
this.parentNode.parentNode.classList.add("over");
});
document.querySelector('.mySelect...
Thimbleweed asked 29/4, 2017 at 11:17
5
Solved
I am trying to make a button that increments a counter's value by 1 when clicked. My code, however, doesn't seem to work.
var count = 1;
var button = document.querySelector("#increment");
...
Mardis asked 4/6, 2020 at 7:34
15
Solved
I have the following code to add eventListener
area.addEventListener('click',function(event) {
app.addSpot(event.clientX,event.clientY);
app.addFlag = 1;
},true);
It is working correctly as ...
Scuffle asked 4/5, 2012 at 6:51
3
Solved
I want to fire a function when the innerHTML of a div element changes.
Been testing with element.addEventListener('DOMCharacterDataModified', myFunction()); but it does not seem to work properly. ...
Bosson asked 19/11, 2017 at 14:50
27
Solved
I have to use vanilla JavaScript for a project. I have a few functions, one of which is a button that opens a menu. It works on pages where the target id exists, but causes an error on pages where ...
Nannie asked 29/9, 2014 at 19:11
4
Solved
How can I make it so that addEventListener() has two functions inside it?
Cooe asked 30/7, 2014 at 4:38
23
Solved
Here is my problem: is it somehow possible to check for the existence of a dynamically attached event listener? Or how can I check the status of the "onclick" (?) property in the DOM? I h...
Fernandefernandel asked 12/7, 2012 at 15:42
2
Solved
I'm trying to disable every click events on a web pages.
document.addEventListener("click", function (e) {
e.preventDefault();
e.stopImmediatePropagation();
let clicked = e.target;
console....
Unreliable asked 19/11, 2020 at 17:4
8
Solved
How can I bind an event listener in rendered elements in Angular 2?
I am using Dragula drag and drop library. It creates dynamic HTML but my event is not bound to dynamic HTML elements.
Subtonic asked 12/1, 2017 at 9:53
2
Solved
I'm making a small drum machine on React, and my idea is that when I press a key on the keyboard a specific sound is played depending which key was pressed. The problem I have is that I want the on...
Remake asked 28/10, 2018 at 16:24
36
Solved
The situation is somewhat like-
var someVar = some_other_function();
someObj.addEventListener("click", function(){
some_function(someVar);
}, false);
The problem is that the value of someVar is...
Prelature asked 2/11, 2008 at 10:36
5
I have registered 'beforeunload' event on created hook of the component used by routes of vue router.
I want to call this event handler in order to remove user on browser tab close or browser tab ...
Karilla asked 9/4, 2018 at 10:43
5
Solved
I have a react component like :
import React, { PropTypes, Component } from 'react'
class MyComponent extends Component {
componentDidMount() {
window.addEventListener("beforeunload", functio...
Weddle asked 23/8, 2016 at 6:47
5
Solved
So we have a page:
<span id='container'>
<a href='#' id='first'>First Link</a>
<a href='#' id='second'>Second Link</a>
</span>
And want to add some click ev...
Tsana asked 30/4, 2013 at 23:12
5
I want to make an alert when a div's innerText changes:
myDiv.addEventListener("change", function() {
if (myDiv.innerText != "some text")
alert('innerText has changed.');
},fa...
Sewole asked 24/6, 2014 at 14:9
9
I have used
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button type="button" id="button">Click</button>
<pre id="ou...
Hitt asked 12/10, 2016 at 8:14
4
Solved
I have attached a click event listener on an element like:
document.querySelector('.class-name').addEventListener('click', function () {
});
The element may or may not get generated from the ser...
Plangent asked 18/7, 2014 at 12:50
2
Solved
I have a single page app with pagination and filters, and need to detect when the current URL changes at all. Is there not a simple way to add a listener to the current URL and trigger something wh...
Paradisiacal asked 21/12, 2017 at 3:39
1 Next >
© 2022 - 2025 — McMap. All rights reserved.