JavaScript Form Validation Flashcards
HTML form is used to collect user input. True or false?
True.
What elements do you put inside the form element?
The Input element and Label element are the most common ones.
What is the label element for?
defines a label for several form elements.
Name all 9 types of the input element.
Text, password, submit, reset, button, checkbox, number, radio, range.
What is the default input type?
Text.
Text is a single-line text input field. True or false?
True.
What does the password input type do?
It makes the user’s input in the form of circles or asterisks.
Is the submit input type a text-field?
No. It is a button.
What does the submit input type do?
It submits user’s input to form handler.
What does the reset input type do?
It resets the user’s input to default value.
With the radio input type, you can only click one option. T or F?
T.
The radio input type will only work if all the names are the same but the ids are different. T or F?
T.
Can the checkbox input type serve as a to do list?
Yes. It is possible.
The button input type is a button that can be used for any use. T or F?
T
What does the number input type do?
It lets the user to input a number.
You can set restrictions on what numbers are accepted. T or F?
T. Use the min attribute and the max attribute.
What element do you use to define a dropdown?
use the select element.
What element do you need for the select element?
The option element.
What does the option element define?
It defines the option in a select element which defines a dropdown.
What element do you use to define a multi-line input field?
textarea element.
What attribute do you put inside the input element to specify an initial value for an input field?
The value attribute.
What does the readonly attribute do?
It cannot be modified. But it can be copy-pasted.
What does the disabled attribute do?
It disables an input element. It is unusable and un-clickable. The value of a disabled input element will not be sent when submitting the form.
What does the size attribute do?
specifies the visible width, in characters, of an input field.
What is the default size value?
20.
The maxlength attribute specifies the maximum number of characters allowed in an input field. T or F?
T.
What does the required attribute do?
With the required attribute, you cannot submit the form if it is not filled out.
What does the JavaScript form validation do?
It validates if the user input is valid or if it meets the requirements.
What does this “==” comparison operator do?
Equal to. It submits true if the operands are equal.
What does this “!=” comparison operator do?
Submits true of the operands are not equal.