codedamn

Introduction to event listeners

Created by Codedamn about a year ago

0

No description provided

13 Comments

    0

    Hi Mehul, can you help me to check this error? I thought I've already gotten along with those codes. It seems that something is wrong with the node.innerText = counter. "Uncaught TypeError: Cannot set properties of null (setting 'innerText')". Thanks in advance.

    @das2108

    Dimas Aaron

    @das2108

    1

    difference between calling the function and passing the name of the function?

    2

    you didnt teach us "getelementbyid" , and how do you expect us to know and apply the differnce between queryselector and getelementById. Please update the video.

    0

    Where can I find the code demonstrated in this video?

    @jkshenoy

    Jayakrishna Sheony

    @jkshenoy

    1

    This is where things start to become real 😎

    @ibrahmounk

    Ibrahima MOUNKORO

    @ibrahmounk

    0

    Hi. Why you used querySelector and getelementById? What's the difference?

    0

    whats the difference if I add my script reference before or after body tag . Becuase when I added script reference inside head tag I got the error like 'uncaught error....'

    0

    5.05k views till 19 jan 2023

    2

    every element has a unique id ,which differs it from rest of list of elements in the DOM. we can say id here is name or address of each node i.e element of DOM returned by Java script which must identify the elements uniquely. https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById

    @shivaprashanth

    Shivaprashanth

    @shivaprashanth

    1

    In this line, "const counterEL = document.getElementById('counter');", counter shouldve been #counter right? because "counter" is the id of the span element in HTML?

    @aisharyaroy1

    Aisharya Roy

    @aisharyaroy1

    1

    someone can plz tell me whats wrong with my code

    const incrementBtn = document.querySelector('#increment') let counter = 0

    function incrementCounter() { const counteEL = document.getElementById('#counter') counter++ counteEL.innerText = counter }

    incrementBtn.addEventListener('click',incrementCounter)

    @iwanatha

    Ashen Iwantha

    @iwanatha

    0

    I really enjoyed this lesson, feels like things are starting to happen, kinda feel that magic if that makes any sense :) I wish you had more practical lessons to try and make the lessons stick a little bettter, without having to go to my own ide to play about.

    @adam697

    Adam

    @adam697

    0

    I Can't get outputs in the browser log just like the video in my own codedamn's playground. I have to go into the chrome's console to see the output.I case of the javascript.

    @shailya0930

    Shailya Motegaonkar

    @shailya0930

Your comment