有没有办法在jeditable(jQuery插件)中添加带有单击事件处理程序的额外按钮?我的目标是,当您单击某个可编辑元素并显示带有“确定”和“取消”按钮的输入元素时,我想添加另一个带有一些文本的按钮,单击它应该将用户重定向到另一个URL。
这能做到吗?任何形式的帮助都会非常感激。提前感谢您花费时间和精力。
最好的问候。
这能做到吗?任何形式的帮助都会非常感激。提前感谢您花费时间和精力。
最好的问候。
$('.editable').live('click', function() {
// Live handler called.
// And here's where it gets tricky with jEditable...the jQuery selector below may be all wrong
$('.editable').append('<button type="submit" class="gotourl">Go to URL</button>');
});
然后
$('.gotourl').live('click', function(){
// Place your redirect code here
}
我刚刚尝试在提交设置中添加另一个按钮,效果还不错。
submit: '<button type="submit" class="ok">OK</button> <button type="submit" class="gotourl">Go To URL</button>'
那么当您点击“转到URL”按钮时,live方法应该触发...但是jEditable也会运行...所以您需要调试它使其一起工作...