问题描述
目标:
如果我为这两个日期选择器选择了日期,例如 2020 年 8 月 14 日,然后我会转到另一个网页。
稍后,我想用 2 个日期选择器返回此网页。这些日期选择器的上一个和选定日期仍可用于选定日期 2020 年 8 月 14 日。
您需要为这些日期选择器应用状态对象/值。
问题:
你如何为这两个日期选择器应用状态管理/对象/值?
有可能做到吗?
我需要什么代码/插件才能实现目标:
Jsfiddle:
https://jsfiddle.net/u7z9fmyd/3/
谢谢!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SPLessons</title>
<link rel='stylesheet' type='text/css' href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css" type="text/css">
</head>
<body>
Start Date: <input class="questionDate" value=" 05/16/2015 "><br>
End Date: <input class="questionDate" value=" 05/31/2015 "><br>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"> </script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"> </script>
<script type="text/javascript" src="script.js"> </script>
</body>
</html>
$(function() {
$("input.questionDate").datepicker({
dateFormat: 'mm/dd/yy'
});
$("input.questionDate").each(function(){
var currentValue = $(this).val();
if(currentValue)
$(this).datepicker('setDate',new Date(currentValue));
});
$("input.questionDate").keydown(function(event) {
if(event.keyCode != 8){
event.preventDefault();
}
});
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)