Javascript Events Tutorial Part 2 – Javascript Tutorials for Beginning Web Development


In the last video, I covered Javascript Events for new Javascript Web Developers. Let’s get a little more complex with those events by adding a loop and some …



  1. For loop is in bad position. If you click on a picture it won't disappear. So I suggest we should add for loop into if statement before pic.className = "";
    Sorry for bad english.
    Thanks for tutorial. 🙂

  2. Sorry if I am a bit stupid, but I am a little bit new to JS so… What's wrong with this? It says "Uncaught SyntaxError: missing ) after argument list"

    for (var a=0; a < listamia.length; a++) {
    if (a == 0 ) {
    alert("hai delle "listamia[a]+" nel tuo cestino");
    } else if (a == 1; a == 3) {
    alert("hai una "listamia[a]+" nel tuo cestino");
    } else if (a == 2) {
    alert("hai della "listamia[a]+" nel tuo cestino");

  3. I studied Web Development client side and server side at the university, I can remember the instructor copy-pasting the code then running it, shows us that it works and then leaves(what a scumbag).
    Thanks for the step by step explanation, however I can understand all of this cause I finished Computer Science BA as I see many struggle through understanding this!

  4. man, this jquery wasnt properly covered and now im trying to get it all to work, so far what ive tryed is ive added the jquery3 js file to my scripts folder and linked it with <script src=…
    but the querySelectorAll isnt working. dont know what to do, unable to progress

  5. Thank you for theses videos so much. I finished this tutorials and I learned a lot! More than any other tutorial here, even when I'm not a native english speaker, I understand you completely. The way you teach is amazing, thank you again.

  6. @12:05 you talk about the which. I think they added something new since your recording, and it's just called key. So you can do console.log(event.key);. so you can replace 13 with Enter.

    function itemKeypress(){
    if ( event.key === "Enter"){;

    I only test in chrome
    Thank you so much for your tutorials!

  7. LearnCode you are by far the best person to teach code. I like your pace and like the fact that you explain what each thing does. I have truly learned more in the past 2 hours watching your videos then i have in the last 3 weeks. Thank you for taking the time to make these tutorials.

    Best regards,

  8. Is there anyone just starting out that would like to learn together with me? I'm about 2 months in and still learning but everything I've seen/read has said it's always easier to learn together and/or with someone who knows more.

  9. Thank you so much for posting these tutorials! Making the jump from basic JavaScript concepts to using JS in the browser – what that actually means – was a huge roadblock for me and you've given me a solid understanding. Again thank you so much. Starting on your node tutorials now as they were a recommendation from a friend.

  10. In function itemKeypress it seems like it would have been simpler to write "this.updateItem" rather than the more complicated "". I tested the former solution and it appears to work, at least on codepen. Is there a reason you chose to use the more complicated version?

  11. I don't understand why you placed event as a parametar inside the brackets of the function itemKeypress(event). It works fine like this itemKeypress(), without the variable event inside its brackets. Is that just to declare to someone who reads the code, to other developer that created function works with events or? I checked elswhere and everyone are doing this part as you, so I'm curious why. Thanks for the great tutorials.

  12. Hello man, you are awesome i watched your whole playlist, I sure made alot of progress with my learning, I am making a project to practice some of the things that i learned but I am having trouble with a code that i am trying to make.

    the objective of the code is to take input that the user types and return the length of the user´s input.

    for that i made this code but the return of the function keeps on being undefined. could you help out?, thanks in advanced


    <div class="row text-center ">
    <div id="count" style="display:none;">
    <h3>Name counter</h3>

    <p>Write your name to see if it is considered it a long name!</p>
    <p><input id="name"></p>
    <p id="namereturn"></p>


    </div> <!-Word counter->



    var yoName = document.getElementById("name");
    var nameReturn = document.getElementById("namereturn");


    function counter() {

    nameReturn.innerHTML = yoName.length;


  13. NEED HELP! I am confused in for loop.

    this loop is supposed to stop if the "i" is not less than items.length right? because of "i++" it will add +1 to "i" ,

    or the "i" is always coming back to value of "0"? that's why the loop is infinite?

    for (var i = 0; i < items.length; i++) {
    items[i].addEventListener("click", editItem);
    inputs[i].addEventListener("blur", updateItem);
    inputs[i].addEventListener("keypress", itemKeypress);