如何在触发 xeditable 之前运行一些代码?并根据结果阻止默认行为?
$('#costumer_phone').editable({
name: 'number',
// THIS IS WHAT I WANT TO ACHIEVE
onClick: function(e){
if (var == true){
e.preventDefault();
}
}
});
最佳答案
您可以使用init
事件,请尝试如下所示。
Fired when element was initialized by $().editable() method. Please note that you should setup init handler before applying editable.
$('#costumer_phone').on('init', function(e, editable) {
if (var == true){
e.preventDefault();
}
});
$('#costumer_phone').editable();
关于javascript - 在触发 x-editable 之前运行一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36992671/