2011-11-22 142 views
4

可以說我有兩個輸入字段HTML 5或者需要輸入字段

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

我可以使用所需的HTML 5屬性來指定,要麼輸入1或輸入2需要

+0

以下鏈接可以幫助你 http://stackoverflow.com/questions/3004703/required-attribute-html5 –

回答

0

還不如currently drafted

必需屬性是布爾屬性。指定時, 元素是必需的。

0

HTML5增加了一個新屬性required。詳情請參閱here

這並不能解決您的問題,因爲它只是爲特定字段定義的,並且不會檢查交叉字段。

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

如果你想有一個更靈活的方式來檢查這個,我建議爲此添加一些JScript。