You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: curriculum/challenges/english/25-front-end-development/review-html-tables-and-forms/671a872c17382a582e455c4c.md
-**`input` element**: used to create an input field for user input.
17
-
-**`type` attribute**: used to specify the type of input field. Ex. text, password, email, etc.
18
-
-**`label` element**: used to create a label for an input field.
19
-
-**`for` attribute**: used to specify which input field the label is for.
20
-
-**Implicit form association**: inputs can be associated with labels by wrapping the input field inside the `label` element.
21
-
-**Explicit form association**: inputs can be associated with labels by using the `for` attribute on the `label` element.
25
+
-**`type` attribute**: used to specify the type of input field. Ex. `text`, `email`, `number`, `radio`, `checkbox`, etc.
22
26
-**`placeholder` attribute**: used to show a hint to the user to show them what to enter in the input field.
23
-
-**`button` element**: used to create a clickable button. Ex. submit, reset, button.
24
-
-**`value` attribute**: used to specify the value of the button.
25
-
-**`required` attribute**: used to specify that an input field must be filled out before submitting the form.
26
-
-**`size` attribute**: used to specify the width of an input field.
27
+
-**`value` attribute**: used to specify the value of the input. If the input has a `button` type, the `value` attribute can be used to set the button text.
28
+
-**`size` attribute**: used to define the number of characters that should be visible as the user types into the input.
29
+
-**`min` attribute**: can be used input types such as `number` to specify the minimum value allowed in the input field.
30
+
-**`max` attribute**: can be used input types such as `number`to specify the maximum value allowed in the input field.
27
31
-**`minlength` attribute**: used to specify the minimum number of characters required in an input field.
28
32
-**`maxlength` attribute**: used to specify the maximum number of characters allowed in an input field.
33
+
-**`required` attribute**: used to specify that an input field must be filled out before submitting the form.
29
34
-**`disabled` attribute**: used to specify that an input field should be disabled.
30
35
-**`readonly` attribute**: used to specify that an input field is read-only.
36
+
37
+
```html
38
+
<!-- Text input -->
39
+
<input
40
+
type="text"
41
+
id="name"
42
+
name="name"
43
+
placeholder="e.g. Quincy Larson"
44
+
size="20"
45
+
minlength="5"
46
+
maxlength="30"
47
+
required
48
+
/>
49
+
50
+
<!-- Number input -->
51
+
<input
52
+
type="number"
53
+
id="quantity"
54
+
name="quantity"
55
+
min="2"
56
+
max="10"
57
+
disabled
58
+
/>
59
+
60
+
<!-- Button -->
61
+
<inputtype="button"value="Show Alert" />
62
+
```
63
+
64
+
-**`label` element**: used to create a label for an input field.
65
+
-**`for` attribute**: used to specify which input field the label is for.
66
+
-**Implicit form association**: inputs can be associated with labels by wrapping the input field inside the `label` element.
67
+
68
+
```html
69
+
<formaction="">
70
+
<label>
71
+
Full Name:
72
+
<inputtype="text" />
73
+
</label>
74
+
</form>
75
+
```
76
+
77
+
-**Explicit form association**: inputs can be associated with labels by using the `for` attribute on the `label` element.
78
+
79
+
```html
80
+
<formaction="">
81
+
<labelfor="email">Email Address: </label>
82
+
<inputtype="email"id="email" />
83
+
</form>
84
+
```
85
+
86
+
-**`button` element**: used to create a clickable button. A button can also have a `type` attribute, which is used to control the behavior of the button when it is activated. Ex. `submit`, `reset`, `button`.
87
+
88
+
```html
89
+
<buttontype="button">Show Form</button>
90
+
<buttontype="submit">Submit Form</button>
91
+
<buttontype="reset">Reset Form</button>
92
+
```
93
+
94
+
-**`fieldset` element**: used to group related inputs together.
95
+
-**`legend` element**: used to add a caption to describe the group of inputs.
96
+
97
+
```html
98
+
<!-- Radio group -->
99
+
<fieldset>
100
+
<legend>Was this your first time at our hotel?</legend>
-**`input` element**: used to create an input field for user input.
100
+
-**`type` attribute**: used to specify the type of input field. Ex. `text`, `email`, `number`, `radio`, `checkbox`, etc.
101
+
-**`placeholder` attribute**: used to show a hint to the user to show them what to enter in the input field.
102
+
-**`value` attribute**: used to specify the value of the input. If the input has a `button` type, the `value` attribute can be used to set the button text.
103
+
-**`size` attribute**: used to define the number of characters that should be visible as the user types into the input.
104
+
-**`min` attribute**: can be used input types such as `number` to specify the minimum value allowed in the input field.
105
+
-**`max` attribute**: can be used input types such as `number` to specify the maximum value allowed in the input field.
106
+
-**`minlength` attribute**: used to specify the minimum number of characters required in an input field.
107
+
-**`maxlength` attribute**: used to specify the maximum number of characters allowed in an input field.
108
+
-**`required` attribute**: used to specify that an input field must be filled out before submitting the form.
109
+
-**`disabled` attribute**: used to specify that an input field should be disabled.
110
+
-**`readonly` attribute**: used to specify that an input field is read-only.
111
+
112
+
```html
113
+
<!-- Text input -->
114
+
<input
115
+
type="text"
116
+
id="name"
117
+
name="name"
118
+
placeholder="e.g. Quincy Larson"
119
+
size="20"
120
+
minlength="5"
121
+
maxlength="30"
122
+
required
123
+
/>
124
+
125
+
<!-- Number input -->
126
+
<input
127
+
type="number"
128
+
id="quantity"
129
+
name="quantity"
130
+
min="2"
131
+
max="10"
132
+
disabled
133
+
/>
134
+
135
+
<!-- Button -->
136
+
<inputtype="button"value="Show Alert" />
137
+
```
138
+
139
+
-**`label` element**: used to create a label for an input field.
140
+
-**`for` attribute**: used to specify which input field the label is for.
141
+
-**Implicit form association**: inputs can be associated with labels by wrapping the input field inside the `label` element.
142
+
143
+
```html
144
+
<formaction="">
145
+
<label>
146
+
Full Name:
147
+
<inputtype="text" />
148
+
</label>
149
+
</form>
150
+
```
151
+
152
+
-**Explicit form association**: inputs can be associated with labels by using the `for` attribute on the `label` element.
153
+
154
+
```html
155
+
<formaction="">
156
+
<labelfor="email">Email Address: </label>
157
+
<inputtype="email"id="email" />
158
+
</form>
159
+
```
160
+
161
+
-**`button` element**: used to create a clickable button. A button can also have a `type` attribute, which is used to control the behavior of the button when it is activated. Ex. `submit`, `reset`, `button`.
162
+
163
+
```html
164
+
<buttontype="button">Show Form</button>
165
+
<buttontype="submit">Submit Form</button>
166
+
<buttontype="reset">Reset Form</button>
167
+
```
168
+
169
+
-**`fieldset` element**: used to group related inputs together.
170
+
-**`legend` element**: used to add a caption to describe the group of inputs.
171
+
172
+
```html
173
+
<!-- Radio group -->
174
+
<fieldset>
175
+
<legend>Was this your first time at our hotel?</legend>
0 commit comments