$('.canEdit').click(function(event) {
/* Act on the event */ var rlist = $(this).parents(".row-list");
var note = rlist.find(".note-txt");
note.attr('contenteditable', 'true');
note.addClass('edit-mode');
note.focus();
rlist.find(".do-action:eq(1)").show().siblings('.do-action').hide();
return false;
});
和
function canEdit(obj) {
/* Act on the event */
var rlist = $(obj).parents(".row-list");
var note = rlist.find(".note-txt");
note.attr('contenteditable', 'true');
note.addClass('edit-mode');
note.focus();
rlist.find(".do-action:eq(1)").show().siblings('.do-action').hide();
return false;
}
一样,,,前者是加了个类促发,后者是οnclick="javascript:canEdit(this);" 促发,为啥要这么搞,是因为jq加载出来的html不能用前者,只能用后者,所以有了这一篇微博