JavaScript-forms Flashcards
What event is fired when a user places their cursor in a form control?
Focus event.
What event is fired when a user’s cursor leaves a form control?
Blur event
What event is fired as a user changes the value of a form control?
Input event
What event is fired when a user clicks the “submit” button within a ?
Submit event
What does the event.preventDefault() method do?
This method tells the browser that if the event does not get explicitly handled, its default action should not be taken as it normally would be.
What does submitting a form without event.preventDefault() do?
Does not reload the page as it normally would
What property of a form element object contains all of the form’s controls
Elements collection
What property of a form control object gets and sets its value?
Value property
What is one risk of writing a lot of code without checking to see if it works so far?
You risk making a mistake that will be difficult to trace later on
What is an advantage of having your console open when writing a JavaScript program?
To see how you’re doing. See your errors.