5

Lets say I have two input fields

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

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

Frank
  • 698
  • 8
  • 16

2 Answers2

1

Not as currently drafted:

The required attribute is a boolean attribute. When specified, the element is required.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
0

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

This doesn't solve your problem because it is just defined for one specific field and doesn't check cross-field.

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

If you want to have a more flexible way of checking this, I advise adding some JScript for this.

Bjoern
  • 15,934
  • 4
  • 43
  • 48