gpt4 book ai didi

jquery - 如何使用 jQuery 使文本框只读,并在单击时显示日历?

转载 作者:行者123 更新时间:2023-12-01 03:48:47 25 4
gpt4 key购买 nike

我有 3 个文本框的女巫,我想将其更改为只读。当您单击文本框时,会出现一个日历,您可以在其中选择日期。这就是我想要的,但用户也可以输入日期,我希望将其删除,因为它是一个 ipad 应用程序,然后调出键盘。

有人可以告诉我如何将文本框设置为只读吗?

$('#AdvertiserSignDate').attr('readonly', true);
$('#ContinentalSignDate').attr('readonly', true);
$('#WitnessSignDate').attr('readonly', true);

如果这是错误的方法,请给我一个好的重定向。

提前致谢;)

最佳答案

工作演示 http://jsfiddle.net/h9bFb/5/ http://jsfiddle.net/6JAYJ/2/

希望这有帮助;

代码

  $(function () {

$("#fromDate, #toDate").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1

}).attr('readonly','true');

});

 $(function () {

var dates = $("#fromDate, #toDate").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1

});

});

html

<label for="from">From</label>
<input type="text" id="fromDate" name="fromDate" readonly='true'/>
<label for="to">to</label>
<input type="text" id="toDate" name="toDate" readonly='true'/>

关于jquery - 如何使用 jQuery 使文本框只读,并在单击时显示日历?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10782838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com