javascript-forms Flashcards

1
Q

What event is fired when a user places their cursor in a form control?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What event is fired when a user’s cursor leaves a form control?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What event is fired as a user changes the value of a form control?

A

The input event fires when the value of an input element, select, element or textarea element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What event is fired when a user clicks the “submit” button within a ?

A

The submit event is fired when a user clicks the “submit” button within a form.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the event.preventDefault() method do?

A

The event.preventDefault() stops the default behavior from occurring. This works for submit, checkbox, and other forms that change the state of the page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does submitting a form without event.preventDefault() do?

A

Submitting a form without event.preventDefault() erases all the inputs by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What property of a form element object contains all of the form’s controls.

A

form.elements contains all of the form controls belonging to the form element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What property of a form control object gets and sets its value?

A

The property of a form control object that gets and sets its value is form.elements.name attribute value.value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is one risk of writing a lot of code without checking to see if it works so far?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an advantage of having your console open when writing a JavaScript program?

A

One advantage of having your console open when writing a JavaScript program is you can see errors as they come and check values quickly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly