Required or required = "required"

I correctly say that the required one is an empty attribute and does not require a value, but xHTML prefers it to be completed. It seems that on all the pages that I created, it works fine without = "required", I'm just wondering if some browsers can interpret them differently.

+4
source share
1 answer

jsFiddle Demo

There is no difference from the perspective of rendering. But if you intend to look into the future for these required elements, it helps to appreciate value.

Mandatory
This attribute indicates that the user must fill in the value before submitting the form. It cannot be used when the type attribute is hidden, the image or button type (submit, reset or button). Optional and: required CSS pseudo-classes will be applied to the field, if necessary. MDN

+4
source

All Articles