VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
addEventListener() - Beau teaches JavaScript

addEventListener() - Beau teaches JavaScript

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
The addEventListener() method attaches an event handler to the specified element without overwriting existing event handlers so you can add many event handlers to one element. You can use removeEventListener() to remove an event. - Code: https://codepen.io/beaucarnes/pen/JNRKXX?editors=1010 - All DOM events: https://developer.mozilla.org/en-US/docs/Web/Events - Beau Carnes on
Date: 2022-03-14

Comments and reviews: 10


Hey, I don't know if you're willing to help people struggling, but I need it. I can get the code to work just fine in most scenarios, but when I open my HTML from the browser and link it to my JS, my addEventListener is run instantly. I've gone to stackoverflow to look for a solution, but received no help there. Why isn't it waiting for the event before running?
reply

I was looking for the explanation of the last parameter of addEventListener, the optional one. Thanks, I think I understand it now! And here's my attempt on trying to explain it with my words: The last parameter decides in which order two events are fired on an event. Innermost(false) or outermost(true) element first - with event bubbling.
reply

When I go to update console I receive this violation and I my console does not update, how can I stop this violation message? [Violation] Added non-passive event listener to a scroll-blocking event. Consider marking event handler as 'passive' to make the page more responsive. ..............Thank you for your consideration.
reply

Hi Beau..Thanks for making all these videos..They are life changing and are really Awesome. I am learning a lot of new things everYday. Just wanna know are there any videos for memory leaks in javscript you did?
reply

Hello I need to pass a callback function that takes an argument. like, btn.addEventListener('click', myFunction(arg)); .... but i had some problems with this as the function ran without a click.... any help please
reply

really good, concise explanation of addEventListener(). It's always good to brush up or have a refresher on pure JavaScript concepts after coding so much in a framework such as VueJS.
reply

Hey, Thanks so much for this, this video helped so much, I was trying to get the click to do something but I couldn't get it until I saw this video, now it's obvious, thanks.
reply

am trying to make social share buttons, but when I do right click or mouse middle click. JS onClick not executing. can you help? TIA
A piece of code example:

reply

Is there a reason why my code works in Codepen but not in VScode? VScode is working because I am using it on another project. Great videos!!!
reply

In the last few seconds of your tutorial, how do you then remove the event listener if it is encapsulated in the function()- [code here]-?
reply
Add a review, comment






Other channel videos