input
字段,可用于创建多个不同的表单控件。此元素的type
属性指示将创建哪种输入。您可能已经注意到text
并在先前的挑战中submit
输入类型,HTML5引入了一个指定date
字段的选项。根据浏览器支持,当日期选择器处于焦点时,它会在input
字段中显示,这使得所有用户都可以更轻松地填写表单。对于旧版浏览器,该类型将默认为text
,因此有助于向用户显示标签中的预期日期格式或以及占位符文本以防万一。这是一个例子: <label for =“input1”>输入日期:</ label>
<input type =“date”id =“input1”name =“input1”>
input
标记,其type
属性为“date”, id
属性为“pickdate”, name
属性为“date”。 input
标记。
testString: 'assert($("input").length == 2, "Your code should add one input
tag for the date selector field.");'
- text: 您的input
标记应具有值为date的type
属性。
testString: 'assert($("input").attr("type") == "date", "Your input
tag should have a type
attribute with a value of date.");'
- text: 您的input
标记应具有值为pickdate的id
属性。
testString: 'assert($("input").attr("id") == "pickdate", "Your input
tag should have an id
attribute with a value of pickdate.");'
- text: 您的input
标记应具有值为date的name
属性。
testString: 'assert($("input").attr("name") == "date", "Your input
tag should have a name
attribute with a value of date.");'
```