invoke cancel on jeditable

醉酒当歌 提交于 2019-12-08 15:38:10

问题


is there a way to invoke "cancel" on a jeditable area from an external call? (instead of clicking cancel) - basically to close the textarea.


回答1:


It looks like jeditable exposes a method for "cancel" directly on the DOM element that was used to initialize the editable section.

For example:

// A paragraph with jeditable initialized like this:
$('p#editable').editable();

// Could be canceled with:
$('p#editable')[0].reset();

Another option would be to trigger the "click" event on the cancel button itself. In order to do this, we can specify specific html for the cancel button.

$('p#editable').editable({
    cancel: '<button class="cancel_button">cancel</button>'
});

// And to cancel:
$('p#editable').find('.cancel_button').click();



回答2:


You can also simply do that:

('.your_jedit_class').each(function(){
    this.reset()
})


来源:https://stackoverflow.com/questions/5290191/invoke-cancel-on-jeditable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!