gpt4 book ai didi

javascript - 日期选择器不工作(ASP.NET MVC)

转载 作者:行者123 更新时间:2023-12-03 01:25:27 26 4
gpt4 key购买 nike

我尝试了这个网站上的代码:http://www.dotnetfunda.com/articles/show/3009/multiple-date-picker-functionality-in-jquery

当我尝试这段代码时,没有任何效果。我也看了其他教程,结果总是一样的。空文本框或空白页。

<html>
<head>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
</head>

<script>
$(function () {
$("#datepicker").datepicker({
numberOfMonths: 4,
showButtonPanel: true
});
});
</script>

<body>
<p>Date: <input type="text" id="datepicker"/></p>
</body>

</html>

该代码适用于代码片段...

最佳答案

正如评论中提到的,是的,它会起作用;因为脚本将在 document.ready() 上运行。纠正我的答案;但将脚本标签保留在正文之后的 html 底部仍然是一个很好的做法。

  <html>
<head>
<link rel="stylesheet" href="//code.jquery.com//ui//1.11.2//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>
</head>
<body>
<p>Date: <input type="text" id="datepicker"/></p>
</body>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function () {
$("#datepicker").datepicker({
numberOfMonths: 4,
showButtonPanel: true
});
});
</script>
</html>

关于javascript - 日期选择器不工作(ASP.NET MVC),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51571473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com