【问题标题】:Datebox - get the event and validate year, month, and date by entering a value manuallyDatebox - 通过手动输入值来获取事件并验证年、月和日期
【发布时间】:2013-08-24 08:13:43
【问题描述】:

我正在为 jquery mobile 使用 datebox 插件http://dev.jtsage.com/jQM-DateBox2/unit/datebox.html

一切正常。

我的问题是如何在不使用加号和减号按钮的情况下通过在特定字段中输入数值((即)keydown/keypress..)来验证单个年份、月份、日期输入字段。

提前谢谢...

【问题讨论】:

    标签: jquery-mobile jquery-plugins datebox


    【解决方案1】:

    此函数检查输入是否更改并将新日期记录到 console.log:

    $("div.ui-grid-b div input.ui-input-text").change(function() {
        var parent = $(this).parent().parent();
        console.log("date changed to: "
                   +parent.find("div.ui-block-a input.ui-input-text").val()+":"
                   +parent.find("div.ui-block-b input.ui-input-text").val()+":"
                   +parent.find("div.ui-block-c input.ui-input-text").val()
                   );
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 2021-12-27
      • 2018-01-05
      • 1970-01-01
      相关资源
      最近更新 更多