【问题标题】:Event for input updated by JQuery calendar由 JQuery 日历更新的输入事件
【发布时间】:2013-07-19 07:42:43
【问题描述】:

Jquery 日历更新输入值时会触发哪个事件?

        <div class='p2_field'>
        <input type="date" class="mainform_textinputs" id="enddate" name="enddate" value="<?php echo $strSicknessEndDate ?>" />
        </div>

        <script type="text/javascript">
            Calendar.setup({
                inputField     :    "enddate",
                ifFormat       :    "%d/%m/%Y",
                button         :    "enddate",
                align          :    "Tl",
                singleClick    :    true
            });
        </script>

我尝试过更改,但它什么也没做

$('.p2_field input').change(function() {

只有当输入失去焦点时才会触发模糊

$('.p2_field input').blur(function() {

【问题讨论】:

  • 您使用的是什么日历库?
  • calendar.js 中的信息显示 $Id: calendar.js,v 1.53 2006/02/11 12:32:59 mishoo Exp $
  • 嗯,我找到了一个旧日历库,里面有那行。但是,它没有设置方法,所以我认为这不是正确的方法。对不起。你知道你是从哪里得到文件的吗?
  • 有一个单独的 calendar-setup.js。网址是:dynarch.com/jscal

标签: jquery events


【解决方案1】:

onSelecthandler,试试:

Calendar.setup({
    inputField     :    "enddate",
    ifFormat       :    "%d/%m/%Y",
    button         :    "enddate",
    align          :    "Tl",
    singleClick    :    true,
    onSelect       :    function () { console.log('Ping!'); }
});

希望这会有所帮助。

【讨论】:

  • 控制台有错误吗?您是否同时使用 calendar.js 和 calendar-setup.js?
猜你喜欢
  • 2020-09-16
  • 1970-01-01
  • 1970-01-01
  • 2020-08-22
  • 1970-01-01
  • 1970-01-01
  • 2018-05-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多