当使用JQuery将TextBox用作Datepicker时,如何限制用户在TextBox中输入任何数据 [英] How to Restrict the user to enter any data into TextBox when that TextBox is used as Datepicker by using JQuery

查看:70
本文介绍了当使用JQuery将TextBox用作Datepicker时,如何限制用户在TextBox中输入任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的Web应用程序中,我使用JQuery将TextBox用作Datepicker.每当Textbox获得焦点时,就会弹出日历,它的工作正常,但问题是当Textbox具有焦点时,如果我输入数字0到9并同时输入"/" Textbox不接受其他符号和字符.

我想限制在该文本框中输入任何类型的数据,包括数字0到9以及同样的"/".


请任何人帮助我实现这一目标.

在此先感谢

Hi all,

In my web application i am using TextBox as Datepicker by JQuery.Whenever that Textbox gets focus a Calender is popig up and It`s working fine but the problem is while Textbox having focus if i enter numbers 0 to 9 and simble "/" Textbox is accepting this not other simbles and characters.

I want to restrict entering any type of data into that textbox including numbers 0 to 9 and simble "/" also.


Please anybody help me to achive this one.

Thanks in advance

推荐答案

set
set
<asp:TextBox ID="txtDate" Width="245px" runat="server" CssClass="input2" onclick="Showcalander1(event)"></asp:TextBox>&nbsp<img

                                        src="images/icon_calander.gif" id="imgdate" runat="server" onclick="Showcalander1(event)"

                                        style="display: inline" />


并根据页面加载时的代码行为设置此


and from code behing on page load set this

txtDate.Attributes.Add("readonly", "readonly");




您可以尝试 [ ^ ].
Hi,

You can try this[^].


这篇关于当使用JQuery将TextBox用作Datepicker时,如何限制用户在TextBox中输入任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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