HTML 5 requires input fields

Suppose I have two input fields

<input id='intput1' type='text' /> <input id='intput2' type='text' /> 

Can I use the html 5 attribute needed to indicate that either input1 or input2 is required

+4
source share
2 answers

Not as currently compiled :

A required attribute is a logical attribute. When indicated, the item is required.

0
source

HTML5 adds a new attribute, required . See here for more details.

This will not solve your problem, because it is defined for only one specific field and does not check cross-fields.

 <input id='intput1' type='text' required='required' /> <input id='intput2' type='text' required='required' /> 

If you want a more flexible way to test this, I suggest adding JScript for this.

0
source

Source: https://habr.com/ru/post/1382434/


All Articles