使用HTML5数据表完成自动完成
DATALIST元素获取ID属性并包含许多OPTION元素,就像SELECT元素一样:
<p>Type php for view example</p> <input name="resources" list="resources" /> <datalist id="resources"> <option value="php"> <option value="php 4"> <option value="php 5"> <option value="css"> <option value="css3"> </datalist>
表单验证与必填
必需属性将任何输入/文本区标记为在提交表单之前需要具有值。
<form > <fieldset> <legend>Required Example</legend> <div> <label for="name">Name (required):</label> <input type="text" id="name" name="name" required="true"> </div> <div> <label for="email">Email (required):</label> <input type="email" id="email" name="email" required="true"> </div> <div> <label>Website:</label> <input type="url" id="website" name="website" required="true"> </div> <input type="submit" value="Submit"/> </fieldset> </form>
-END-