xeditable文本框内的屏蔽输入无法正常工作

abh*_*bhi 4 html jquery maskedinput twitter-bootstrap x-editable

我有一个x-editable输入我的bootstrap应用程序,我用来编辑用户名.现在我需要使用jquery.maskedinput.min.js来获取蒙版格式,同时我输入文本框,当我点击跨度时,正如x-editable中那样.这是我的示例html代码

<div id="sZip" class="profile-info-value ">
<span class="editable" id="Dob">dob</span>
</div>
Run Code Online (Sandbox Code Playgroud)

我通过应用这样的j查询获得了x editable

  $('#zip').editable({
                    type: 'text',
                    name: 'zip',
                    tpl:'   <input type="text" id ="zipiddemo" class="form-control    input-sm dd" style="padding-right: 24px;">'

                });
Run Code Online (Sandbox Code Playgroud)

它工作正常现在我需要使该文本框可屏蔽,但当我调用这样的蒙版输入函数时

$(".dd").mask("99999-?9999");
Run Code Online (Sandbox Code Playgroud)

它不工作,我不知道确切的原因.任何帮助将不胜感激

Dhi*_*raj 10

它不起作用,因为x可编辑元素是动态添加的.

我希望这有效.

$('#users a').editable({
    type: 'text',
    name: 'username',
    tpl: '<input type="text" id ="zipiddemo" class="mask form-control    input-sm dd" style="padding-right: 24px;">'
});

$(document).on("focus", ".mask", function () {
    $(this).mask("(999) 999-9999? x99999");
});
Run Code Online (Sandbox Code Playgroud)

DEMO

  • hai Dhiraj Bodicherla我还有一个疑问,如何在x-editable中显示密码字段。如果我有数据库中的密码字段,然后在可编辑功能中输入类型:“ password”,则当我单击跨度时,它会显示为密码,然后单击“提交”按钮。它会显示为“ [隐藏]”。我的问题是第一次来自数据库的数据,当我将该值放入span时,它只是显示了实际值,我怎样才能使它看起来像“ [隐藏]” (2认同)