jquery 鼠标双击文本框不会阻止浏览器缓存中的值
我有一个由 jquery 日期选择器生成的日期输入文本框,它仅用于显示当前日期的日期。
但是,如果用户以前使用过该表单,他可以选择以前生成的日期,双击该日期会显示浏览器缓存中的日期选择。
这将帮助用户预订当前日期之前的日期。我正在使用服务器端检查来解决它。但是有什么方法可以防止这种情况发生。我尝试根据此链接中的所有建议阻止双击,但无济于事
1]http://stackoverflow.com/questions/5241981/disable-mouse-double-click-using-javascript-or-jquery
I have a Date Input text box generated by jquery Date Picker which is only meant to display dates from the current date.
However if a user has used the form previously, he is able to choose previous dates generating from which on double clicking displays a choice of dates from his browser cache.
This would help a user book dates that are prior to current dates. I am solving it using a sever side check. However is there a way I can prevent this. I tried preventing double clicks based on all suggestions in this link, but no avail
1]http://stackoverflow.com/questions/5241981/disable-mouse-double-click-using-javascript-or-jquery
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
autocomplete="off"
添加到您的元素中。这将阻止浏览器显示以前输入的值。
您还应该验证日期服务器端,以确保没有任何内容通过客户端网络。
Try adding
autocomplete="off"
to your<input>
element. This will prevent the browser from showing previously entered values.You should also validate the date server side to ensure nothing slips through the client side net.
不要将日期输入放入您提交搜索的
Do not put your dateinput in the
<form>
you submit your search with, but populate a hidden input on submit. You will not be able to prevent browsers from caching data of your dateinputs if they actually are part of the form submit your search with.