如何让 Aloha Editor 识别和编辑动态创建的 dom/内容?
我通常使用 jquery 并使用 '.live' 或 '.on' 来让它工作,但不知道如何使用 Aloha。
谢谢
如何让 Aloha Editor 识别和编辑动态创建的 dom/内容?
我通常使用 jquery 并使用 '.live' 或 '.on' 来让它工作,但不知道如何使用 Aloha。
谢谢
要创建动态 aloha 实例:
$(document).ready(function(){
// Add an editable upon clicking on some button Button
$("#Button").click(function () {
    var $ = Aloha.jQuery;
    $('#somewhere').append('<div class="editable" id="ed" ></div>');
    Aloha.jQuery('.editable').mahalo();
    Aloha.jQuery('.editable').aloha();   
});
现在您可以简单地获取内容:
var e = Aloha.getEditableById('ed'); 
getContents();
我没有测试过它,但它应该可以工作。