[英]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.