页面加载后如何将datepicker值设置为所选日期? [英] How to set datepicker value to selected date after page load?
本文介绍了页面加载后如何将datepicker值设置为所选日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个日期选择器,它具有 id ="from_dt"
和带有 id ="fromToDate"
的按钮.当我从日期选择器中选择一个日期并单击按钮时,页面将加载,然后我要将所选的日期选择器值设置为文本框.
I have one datepicker having id="from_dt"
and button with id="fromToDate"
.
When i select a date from the datepicker and click the button, the page will load and then i want to set that selected datepicker value to a textbox.
<input class="form-control" id="from_dt" type="text" placeholder="From Date" value="" readonly>
<input type="submit" class="btn btn-outline btn-primary btn-xs" id='fromToDate' value="Search" onclick="getEventListWithDateTime()">
这是按钮单击功能:
function getEventListWithDateTime() {
$("#eventListDatePickerForm").attr( "action", "/eventList/" + $("#from_dt").val() + "/" + $("#to_dt").val());
}
推荐答案
在jquery UI datepicker的文档中,它说: $(".selector").datepicker("setDate","10/12/2012);
In the documentation of jquery UI datepicker it says: $( ".selector" ).datepicker( "setDate", "10/12/2012" );
请参阅:文档
这篇关于页面加载后如何将datepicker值设置为所选日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文