我正在尝试使Jeditable适用于使用此jquery 文件树创建的新元素。
右键单击文件夹或文件会显示上下文菜单,单击上下文菜单上的“重命名”项后,我想激活 Jeditable。
我正在使用这个上下文菜单和这个代码:
$(document).ready( function() {
$('#filetree').fileTree({
root: '../../../',
script: './connectors/jqueryFileTree.php',
expandSpeed: 1000,
collapseSpeed: 1000,
multiFolder: true
}, function(file) {
alert(file);
});
$.contextMenu({
selector: 'ul.jqueryFileTree > li',
callback: function(key, options) {
var m = "clicked: " + key;
window.console && console.log(m);
if(key == 'rename'){
$('#1').trigger("edit1");
}
},
items: {
"rename": {name: "Rename", icon: "edit", accesskey: "r"},
"cut": {name: "Cut", icon: "cut", accesskey: "c"},
// first unused character is taken (here: o)
"copy": {name: "Copy", icon: "copy", accesskey: "c o p y"},
// words are truncated to their first letter (here: p)
"paste": {name: "Paste", icon: "paste", accesskey: "cool paste"},
"delete": {name: "Delete", icon: "delete"},
}
});
/* Bind Jeditable instances to "edit" event. */
$("#1").editable("http://www.example.com/save.php", {
event: 'edit1',
});
});
});
但不起作用,我在网上(这里)读到我应该使用 .live(.on() 可以吗?因为我使用的是 jquery 1.7.1)但我不知道为什么,你能帮我?