2016-02-16 49 views
0

x-editable + maskedinput在輸入時從maskedinput返回下劃線,但當點擊時不會返回下劃線。有想法該怎麼解決這個嗎?x-editable + maskedinput在輸入時返回下劃線但不是在點擊

的jsfiddle:

jQuery的圖書館:

HTML:

<a href="#" data-pk="1">1</a> 

JS:

$('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"); 
}); 

回答

0

的jsfiddle:

HTML:

<a href="#" data-pk="1">1</a> 

JS:

$('a').editable({ 
    type: 'text', 
    name: 'username', 
    tpl: '<input type="text" id ="zipiddemo" class="mask form-control input-sm dd" style="padding-right: 24px;">', 
    display: function(value, response) { 
     return false; 
    }, 
    success: function(response, newValue) { 
     $(this).html(newValue.replace(/_/g, '')); 
    }, 
}); 

$(document).on("focus", ".mask", function() { 
    $(this).mask("?999"); 
});