我只是对 jQuery 不够熟悉,无法使其正常工作。使用 jQuery Datepicker 插件,并且已经有了一些帮助,我让它工作,除了用选定的工作日值更新隐藏的输入元素。我尝试过的一切都会干扰 Datepicker 插件的功能。欢迎任何帮助。
<html>
<head>
<script src="../js/jquery.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<title> jquery date picker </title>
<script type="text/javascript">
$(function () {
$("#Datepicker").datepicker();
});
</script>
<script type="text/javascript">
function pickdate() {
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ];
var selecteddate = $("#Datepicker").datepicker('getDate');
$('#Datepickerday').html(days[selecteddate.getDay()]);
// also needs to update hidden input 'weekday' with day of week
}
</script>
</head>
<body>
Date: <input type="text" name="Datepicker" id="Datepicker" class="Datepicker" onchange="pickdate();">
<br><br>
Day: <span id="Datepickerday"></span>
<input type="hidden" name="weekday" id="weekday">
</body>
</html>