javascript-forms Flashcards
What event is fired when a user places their cursor in a form control?
The event that is fired when a user places their cursor in a form control is the mousenter event. When the user clicks into a form control, the focus event is fired.
What event is fired when a user’s cursor leaves a form control?
The event that is fired when a user’s cursor leaves a form control is the mouseleave event. When a user clicks out of the form input area, the blur event is fired.
What event is fired as a user changes the value of a form control?
The input event fires when the value of an input element, select, element or textarea element.
What event is fired when a user clicks the “submit” button within a ?
The submit event is fired when a user clicks the “submit” button within a form.
What does the event.preventDefault() method do?
The event.preventDefault() stops the default behavior from occurring. This works for submit, checkbox, and other forms that change the state of the page.
What does submitting a form without event.preventDefault() do?
Submitting a form without event.preventDefault() erases all the inputs by default.
What property of a form element object contains all of the form’s controls.
form.elements contains all of the form controls belonging to the form element
What property of a form control object gets and sets its value?
The property of a form control object that gets and sets its value is form.elements.name attribute value.value
What is one risk of writing a lot of code without checking to see if it works so far?
One risk of writing a lot of code without checking to see if it works so far is either having to delete all the code after the mistake or the mistake being less obvious the higher up in code it is.
What is an advantage of having your console open when writing a JavaScript program?
One advantage of having your console open when writing a JavaScript program is you can see errors as they come and check values quickly.