JS1: Attendance and activity¶
Update HTML text content with JavaScript¶
What is happening here - how does submitHandler get
event
? What isevent
?myForm.addEventListener("submit", submitHandler); function submitHandler(event) {... }
Which other ways there exist to pass arguments to submitHandler() or to callback functions in general?
Why is addEventListener() considered a better practice than onClick or onSubmit?
Which elements this code snippet returns? How do you get all form elements? How to make the query more specific?
document.querySelector("form");
What is the difference between
event.target
andevent.currentTarget
?
TODO¶
How classes should be added to an element? How are they removed? Why is the syntax like this?
Why does element.class = “xyz” not add the class attribute?
What does this command do?
element.classList.toggle("done");
What other methods does
classList
have?What is the difference between Element.prepend() and Element.append()? What about Element.before() and Element.after()?
A+ presents the exercise submission form here.