Skip to main content

Questions tagged [addeventlistener]

a DOM event method that adds an event listener to a given DOM node

addeventlistener
0 votes
0 answers
42 views

The Enter key works every time I call addEventListener ("click")

I'm trying to make a calculator, and in the middle of the coding, I see that when I press the enter key, he calls the last addEventListener ("click") I used, but I don't set any work for the ...
Leonardo Dutra's user avatar
0 votes
0 answers
8 views

handle multiple tabs with listener

I want to create an event listener on every new tab user creates when clicking on any pages, is it possible? this is required to capture user events based on clicks within this new tabs. Like a ...
RobertKirk's user avatar
-1 votes
0 answers
36 views

window.addEventListener does not work on iOS

I want to write a function to listen to sessionStorage. I found that the following code works fine on both computers and Android phones, but it suddenly stopped working on iOS phones recently. Does ...
Nico's user avatar
  • 1
-1 votes
2 answers
53 views

Changing CSS display property with JS EventListener

I am trying to add functionality to a button on a project I'm working on...when the button is pressed I want an element to no longer show on the page. However, I can't get this process to work. Here ...
R Todd M's user avatar
-1 votes
2 answers
41 views

How can I select HTML elements which are rendered after DOM

I want to select OKBTN let main = document.querySelector("#main"); let okBtn = document.querySelector("#ok"); function myAlert(title,msg,icon){ let card = ""; ...
Pawan Lal Rathore's user avatar
0 votes
0 answers
44 views

what is the error in my code (javascript), why it is not looping over my array? [duplicate]

My script is not looping over my array. There is always an error showing. Please find what's the error is. I really can't find it. I tried this multiple time but its not working. Im trying to make a ...
user25956644's user avatar
-1 votes
1 answer
23 views

dblclick, onmouseover events not working for me ( i am using chrome)

const b = document.querySelector('#but'); b.addEventListener('dblclick', () => { console.log('dblclick'); }); b.addEventListener('mouseenter', () => { console.log('mouseenter'); }); b....
SRIRAM's user avatar
  • 1
0 votes
1 answer
46 views

Why does the action handler function always capture the initial value of `useState`? [duplicate]

I have view where I want to add a scroll action listener to. I want to get the current scroll offset and compare its previous value to do something. Here is code: const StickyBox = () => { const [...
刘maxwell's user avatar
0 votes
0 answers
25 views

Webpage not updating content when mobile screen resizes

I have created a webpage and made it responsive only for horizontal phone screens. So i've tried to implement eventlisteners. If the phone screen is vertical, I will not display the content, however ...
Han's user avatar
  • 9
0 votes
2 answers
33 views

event listener only updates innerHTML on odd numbered circumstances

I have an index of projects that I want to be able to filter on click. The filter itself works fine on every click with the following code by hiding the visibility of non-highlighted projects, but the ...
oglorp's user avatar
  • 11
0 votes
0 answers
25 views

what is the 'this' keyword in the .on method's callback function of leaflet library?

Im curious because the this keyword inside of JavaScript's event handler function is the element in which the .eventListener() is attached to. And the .on() method of leaflet library is similar to ....
huz3y's user avatar
  • 21
0 votes
0 answers
41 views

Lighthouse couldn't run because "The page did not paint any content" (NO_FCP)

I'm having an issue running a Lighthouse test on a page I'm testing. I think I've found the root of the problem - but I don't fully understand why it is causing a problem at the exact same script ...
user1406440's user avatar
  • 1,545
0 votes
1 answer
25 views

Javascript jQuery activate a class method after click event in class object [duplicate]

syntax for starting the class method Creation of myClass is oke but when event the method of the class doesn't work class myClass { constructor(toElement, options) { var self = this; this....
Steven Pollentier's user avatar
1 vote
1 answer
43 views

Why aren't my event listeners being removed?

public zoom(dragZoomActive: boolean): void { const onMouseDown = (event: MouseEvent) => { /*code*/ } const onMouseMove = (event: MouseEvent) => { /*code*/ } ...
SourBanana's user avatar
1 vote
1 answer
39 views

How to add math function without eval to basic calculator

Per the Odin Project's instructions, I need to make my basic calculator operate via math functions rather than using eval(). https://www.theodinproject.com/lessons/foundations-calculator I've only ...
Reginald86's user avatar

15 30 50 per page
1
2 3 4 5
298