This course has already ended.

JS1: Attendance and activity

Update HTML text content with JavaScript

  1. What is happening here - how does submitHandler get event? What is event?

    myForm.addEventListener("submit", submitHandler);
    function submitHandler(event) {... }
    
  2. Which other ways there exist to pass arguments to submitHandler() or to callback functions in general?

  3. Why is addEventListener() considered a better practice than onClick or onSubmit?

  4. Which elements this code snippet returns? How do you get all form elements? How to make the query more specific?

    document.querySelector("form");
    
  5. What is the difference between event.target and event.currentTarget?

TODO

  1. How classes should be added to an element? How are they removed? Why is the syntax like this?

  2. Why does element.class = “xyz” not add the class attribute?

  3. What does this command do?

    element.classList.toggle("done");
    
  4. What other methods does classList have?

  5. What is the difference between Element.prepend() and Element.append()? What about Element.before() and Element.after()?

A+ presents the exercise submission form here.

Posting submission...