To make a field mandatory in HTML 5 forms, which word is used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

To make a field mandatory in HTML 5 forms, which word is used?

That field in form which we can't leave empty.

4th Jan 2018, 9:22 AM
Shah Raashed
Shah Raashed - avatar
5 Answers
+ 5
required <input type="text" required>
4th Jan 2018, 9:25 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 3
no @Raashed he is talking about XHTML, in XHTML attributes minimisation is forbidden.. u have to use it as <input type= "text" required="required"> and in html u have specified wrong syntax.. type attribute defines the type of value the input field will take.. type can never have value as required.. required itself is an attribute.. so the syntax goes as : <input type="text" required>
4th Jan 2018, 9:33 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
XHTML: <input required="required">
4th Jan 2018, 9:27 AM
romangraef
+ 1
it is <input type= required/> @romangraef
4th Jan 2018, 9:29 AM
Shah Raashed
Shah Raashed - avatar
+ 1
yes bro @Sami... but I didn't wrote "text"... and in XHTML I didn't know how we use it... thank you for your answers
4th Jan 2018, 9:36 AM
Shah Raashed
Shah Raashed - avatar