[英]JQuery JEditable Plugin On Focus Notify Callback Function
我想在創建“可編輯輸入”框后立即附加事件。 據我所知,這是一個“模糊”但沒有重點。 有誰知道一種快速的方法來做到這一點?
有多種方法可以實現,但是自定義輸入是一種。 您可以執行以下操作:
$.editable.addInputType('textarea_hover', {
element : $.editable.types.textarea.element,
plugin : function(settings, original) {
$('textarea', this).bind('focus', function() {
/* Do something on focus. */
});
}
});
然后像這樣調用Jeditable:
$('.edit_area').editable('http://www.example.com/save.php', {
type : 'textarea_hover',
cancel : 'Cancel',
submit : 'OK'
});
默認情況下,該插件在click事件上起作用,因此請嘗試$(selector).editable(options).click(function(){foo();});
根據您要執行的操作,可以將click事件綁定到可編輯元素,而不是onfocus:
$(document).ready(function() {
$('.edit').editable('http://www.example.com/save.php');
$('.edit').click(function () { ... }
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.