【发布时间】:2015-02-26 10:25:32
【问题描述】:
我想让 2 个数据选择器工作,但他们没有。我认为我的代码中的一切都很好,但我不知道为什么它不起作用。 我的代码有一部分:
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<table>
<tr>
<td>Data1 :
<input type="text" id="datepicker"></td>
<td>Data2 :
<input type="text" id="datepicker"></td>
</tr>
</table>
<button>Next</button>
</body>
你能告诉我这段代码有什么问题吗?
【问题讨论】:
-
无效标记:重复相同的 ID。将其更改为
class而不是id并在上面的脚本中使用.点来引用它。 -
注意:没有doctype,也没有
html标签。 -
两个具有相同 ID 的元素.. ssilas777 答案是解决方案。使用类..
标签: jquery html datapicker