触发jQueryUI的日期选择器按钮点击,发送结果禁用输入字段 [英] Trigger jQueryUI datePicker on button click, send result to disabled input field

查看:166
本文介绍了触发jQueryUI的日期选择器按钮点击,发送结果禁用输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种方式来做到这一点,但无法找到任何

我想有:


  • 禁用输入文本字段,称为#XX。该输入将存储选定值从日期选择器(如本输入无效我将无法使用该触发日期选择器)


  • 按钮,除了#XX。当用户点击这个按钮,日期选择器会显示出来。用户将选择日期,这一日期将被分配到残疾人输入#XX。


我想这使用户不能手动更改-by打字crap-所选日期

另外,我要验证是否使用#XX.val()中输入的日期?还是有更好的办法?


解决方案

 <脚本类型=文/ JavaScript的>
    $(函数(){
        $(#日期选择器)。日期选择器({
            constrainInput:真实,
            showOn:按钮,
            buttonText:'选择...'
        });
    });
< / SCRIPT>
<输入ID =日期选择禁用=禁用/>

这将增加旁输入字段一个按钮,进入文本到现场...

禁用用户

I've been searching for a way to do this, but could not find anything

I want to have a:

  • Disabled input text field, called #XX. This input will store the selected value from datepicker (as this input is disabled I won't be able to use this to trigger the datePicker)

  • Button, besides #XX. When user clicks this button, datePicker will show. User will select the date, and this date will be assigned to disabled input #XX.

I want this so user can't change manually -by typing crap- the selected date

Also, should I validate if date was entered using #XX.val()? or is there a better way?

解决方案

<script type="text/javascript">
    $(function () {
        $("#datepicker").datepicker({
            constrainInput: true,
            showOn: 'button',
            buttonText: 'Select...'
        });
    });
</script>
<input id="datepicker" disabled="disabled" />

This will add a button next to the input field, and disable the user from entering text into the field...

这篇关于触发jQueryUI的日期选择器按钮点击,发送结果禁用输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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