javascript-forms Flashcards
What event is fired when a user places their cursor in a form control?
Focus
What event is fired when a user’s cursor leaves a form control?
blur
What event is fired as a user changes the value of a form control?
change or input
What event is fired when a user clicks the “submit” button within a <form>?
submit
What does the event.preventDefault() method do?
The preventDefault method is a method of the Event object that cancels the default action of an event.
What does submitting a form without event.preventDefault() do?
Submitting a form without calling event.preventDefault() will allow the default action of the submit event to occur, which is to send the form data to the server or browser
What property of a form element object contains all of the form’s controls.
the elements property
What property of a form control object gets and sets its value?
value
What is one risk of writing a lot of code without checking to see if it works so far?
You can get far into the code and find it does not work. Not knowing where the error was you will waste time looking through all of the code created thus far to find the error.
What is an advantage of having your console open when writing a JavaScript program?
To see if things are working as you are creating them. This allows you to fix problems right away without getting too far away from the error in your code.