I use datepicker from jQuery UI.
我使用来自jQuery UI的datepicker。
Here you can see my initial code
在这里你可以看到我的初始代码。
$('#fromDate').datepicker({
showOtherMonths: true,
minDate: 0,
dateFormat: 'dd MM yy',
onSelect: function(dateText, inst) {
$(this).text(dateText);
},
altField: '#startDate',
altFormat: 'dd.mm.yy'
},
$.datepicker.regional[ "ru" ]
);
After select date, datepicker destroy, but I don't need that datepicker destroy.
选择日期后,datepicker销毁,但我不需要datepicker销毁。
1 个解决方案
#1
2
The issue you were facing was because of writing to the text property of the div, to which your date picker is attached. So the idea is to create two separate divs, one for the date picker and one for the selected value.
您所面临的问题是由于写入了div的文本属性,而您的日期选择器被附加在该div中。因此,我们的想法是创建两个独立的div,一个用于日期选择器,一个用于选择的值。
HTML:
HTML:
Date: <div id='SelectedDate'></div>
<div id='fromDate'></div>
Jquery:
Jquery:
$('#fromDate').datepicker({
showOtherMonths: true,
minDate: 0,
showAnim: '',
dateFormat: 'dd MM yy',
onSelect: function (dateText, inst) {
$('#SelectedDate').text(dateText);
},
altField: '#startDate',
altFormat: 'dd.mm.yy'
},
$.datepicker.regional["ru"]);
Now you can add other elements in your HTML and do a .datepicker("destroy") on lcikc when you no longer need it.
现在您可以在您的HTML中添加其他元素,在您不再需要的时候,在lcikc上执行.datepicker(“销毁”)。
EDIT: Forgot the Fiddle Link : http://jsfiddle.net/TGy3s/1/
编辑:忘记了小提琴链接:http://jsfiddle.net/TGy3s/1/。
#1
2
The issue you were facing was because of writing to the text property of the div, to which your date picker is attached. So the idea is to create two separate divs, one for the date picker and one for the selected value.
您所面临的问题是由于写入了div的文本属性,而您的日期选择器被附加在该div中。因此,我们的想法是创建两个独立的div,一个用于日期选择器,一个用于选择的值。
HTML:
HTML:
Date: <div id='SelectedDate'></div>
<div id='fromDate'></div>
Jquery:
Jquery:
$('#fromDate').datepicker({
showOtherMonths: true,
minDate: 0,
showAnim: '',
dateFormat: 'dd MM yy',
onSelect: function (dateText, inst) {
$('#SelectedDate').text(dateText);
},
altField: '#startDate',
altFormat: 'dd.mm.yy'
},
$.datepicker.regional["ru"]);
Now you can add other elements in your HTML and do a .datepicker("destroy") on lcikc when you no longer need it.
现在您可以在您的HTML中添加其他元素,在您不再需要的时候,在lcikc上执行.datepicker(“销毁”)。
EDIT: Forgot the Fiddle Link : http://jsfiddle.net/TGy3s/1/
编辑:忘记了小提琴链接:http://jsfiddle.net/TGy3s/1/。