Introduction: HTML Required Fields

If you want to make your form fields required so that the browsers stops a user from submitting empty fields, then the "required" attribute is for you. It is supported on most modern browsers and full support information can be found at http://caniuse.com/#feat=form-validation

Step 1: Locate Your HTML Form

Find the file with the HTML form you want to edit and open it in your favorite text editor.

Step 2: Add the "required" Attribute

Add the "required" attribute to each field that you want to be required.

Step 3: Refresh Your Page and Test

And you are done! Remember to make sure that the browsers your users have supports this by checking the compatibility at http://caniuse.com/#feat=form-validation

Comments

author
amberrayh (author)2015-06-09

This is very helpful. Thank you for sharing!