Bootstrap Datepicker(避免文本输入或限制手动输入) [英] Bootstrap Datepicker (avoid text input or restrict manual input)

查看:1543
本文介绍了Bootstrap Datepicker(避免文本输入或限制手动输入)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的网站: http://splash.inting.org/wp/

我目前使用的是 Bootstrap Datepicker(范围)分支)我的通话日期字段,它很棒。

I currently use the Bootstrap Datepicker (range branch) for my Call Date field and it's been great.

虽然我有 2个问题

1)您可以在输入字段中手动输入字符串。这很奇怪,因为 eyecon的原创在您输入非当时输入当前日期时不允许日期值。我尝试了readonly属性,它似乎不起作用,因为它不允许你选择任何日期。

1) You can manually enter strings in the input field. This is weird since the original by eyecon disallowed it by entering the current date whenever you enter non-date values. I tried the readonly attribute and it doesn't seem to work because it won't allow you to select any date.

2)我将日期输入选择限制为星期二和星期四在另一篇文章中修改答案。加载日期选择器后,选择的默认日期是当前日期,可以是一周中的任何其他日期。我想避免这种情况,只选择星期二或星期四。

2) I limited the date input choices to Tuesdays and Thursdays by modifying an answer in another post. Upon loading the datepicker, the default date chosen is the current date, which can be any other day of the week. I want to avoid this and have only either Tuesdays or Thursdays selected.

推荐答案

覆盖输入控件上的关键事件。

Override the key events on the input control.

<input onkeydown="return false" ... />

这篇关于Bootstrap Datepicker(避免文本输入或限制手动输入)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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