JQuery DatePicker ReadOnly [英] JQuery DatePicker ReadOnly

查看:86
本文介绍了JQuery DatePicker ReadOnly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将datepicker设为只读时,我看到用户无法在文本框中输入任何内容。

When I make my datepicker read-only, I see that the user cannot type anything into the text box.

$("#datepicker").attr('readonly', 'readonly');

但是,他们仍然可以使用日历更改值。如何隐藏日历以使用户无法更改日期值?

However, they can still change the value using the calendar. How can I hide the calendar so that users cannot change the date value?

我不想禁用日期戳,因为我需要在表单提交时发布到服务器的值。

I do not want to disable the datepicker since I need the value posted to the server upon form submit.

(#datepicker)。datepicker('disable');

("#datepicker").datepicker('disable');

推荐答案

您可以将范围设置为无效范围,以便用户无法选择任何日期:

You can set the range allowed to some invalid range so the user can't select any date:

$("#datepicker").datepicker({minDate:-1,maxDate:-2}).attr('readonly','readonly');     

这篇关于JQuery DatePicker ReadOnly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆