From the course: Building Great Forms with HTML and CSS

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

New input attributes

New input attributes

From the course: Building Great Forms with HTML and CSS

Start my 1-month free trial

New input attributes

- [Instructor] In addition to setting the type attribute on an input field, we have a plethora of additional attributes that can make our forms more user friendly. Now we've already discussed the necessity of setting a name attribute. This is used to reference elements in a JavaScript file, or to reference form data after the form has been submitted. As well as the ID attribute, this associates the input with its labels for attribute and can be used with CSS and JavaScript. Remember that each ID needs to be unique per page. In addition to these attributes, we have some other helpful ones. The first one that we're going to be looking at is the value attribute. This is going to specify the initial value for an input field. Setting the value can be problematic, since users may overlook the field thinking it has already been filled out, or it could cause issues with validation. So be careful using this. When you set…

Contents