【问题标题】:unable to handle validation property in x-editable popup field无法处理 x 可编辑弹出字段中的验证属性
【发布时间】:2013-09-30 10:56:29
【问题描述】:

我能够处理提交事件,但无法处理可编辑的验证属性。

下面是我的代码:

HTML 代码

<a id="aspPhoneNumber" class="edit labelProps editable editable-click editable-empty" style="word-wrap:break-word;" data-original-title="" title="">Empty</a>

JavaScript 代码:

$(document).ready(function () {
      $('#aspPhoneNumber').editable({
            type: 'text',
            placement: 'right',
            success: function (response, newValue) {
                alert(response)
            }
        });
     $('#aspPhoneNumber').editable('option','validate', function (v) {
            alert("this"+v);
            if ($.trim(v) == '') { return 'Required field!'; }
        });
    $('.editable-submit').on('click', function () {
            alert("submited");
      });

});

【问题讨论】:

    标签: javascript jquery twitter-bootstrap jquery-select2


    【解决方案1】:

    从可编辑的 HTML 中删除单词“Empty”,使其成为真正的空/空值。

    http://jsfiddle.net/4ZSX2/

    <a id="aspPhoneNumber" class="edit labelProps editable editable-click editable-empty" style="word-wrap:break-word;" data-original-title="" title=""></a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多