Datepicker字段应该只使用jquery只读 [英] Datepicker field should be readonly using jquery
本文介绍了Datepicker字段应该只使用jquery只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have this code
$("#FromDate").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-100:+10",
dateFormat: 'dd-M-yy',
onSelect: function (dateStr) {
var max= new Date(dateStr);
max.setDate(max.getDate() + 1);
$('#ToDate').datepicker('setDate', max);
$("#ToDate").attr('readonly', true);
}
});
ToDate datepicker date is set properly and also looked readonly. but when i click on ToDate it's shows me the date calendar. which should not populated as per my need.
Kindly suggest what should I do?
我尝试了什么:
What I have tried:
$("#ToDate").attr('readonly', true);
推荐答案
(#FromDate)。datepicker({
changeMonth:true,
changeYear:true,
yearRange: - 100:+10,
dateFormat:'dd-M-yy',
onSelect:function(dateStr){
var max = new Date(dateStr);
max.setDate(max.getDate()+ 1);
("#FromDate").datepicker({ changeMonth: true, changeYear: true, yearRange: "-100:+10", dateFormat: 'dd-M-yy', onSelect: function (dateStr) { var max= new Date(dateStr); max.setDate(max.getDate() + 1);
('#ToDate')。datepicker('setDate',max);
('#ToDate').datepicker('setDate', max);
(#ToDate)。attr('readonly',true);
}
});
ToDate datepicker日期设置正确,也看起来只读。但是当我点击ToDate时,它会显示日期日历。不应该根据我的需要填充。
请建议我该怎么做?
("#ToDate").attr('readonly', true); } }); ToDate datepicker date is set properly and also looked readonly. but when i click on ToDate it's shows me the date calendar. which should not populated as per my need. Kindly suggest what should I do?
我尝试了什么:
What I have tried:
这篇关于Datepicker字段应该只使用jquery只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文