开发者

jquery editor on dom elements

I'm trying to use a wysiwyg editor to change content on newly created div elements.but i'm unable to do so. the editor only see pre existing elements in the html but not newly created ones. I'm using the following code to create new div element.

$("button").click(function() {
  var elm = $('<div id="text">testing testing</div>');
  elm.appendTo('#wrapper');

I'm using ckeditor to make the created div editable. This is by simply doing this

$('#text').ckeditor();

This is not wor开发者_运维百科king. Editor cannot see the newly created div. Regardless to what editor i use, this is always the case. What am i doing wrong. Any solution for this.


You need to attach editor after the element was created.

$("button").click(function() {
    var elm = $('<div id="text">testing testing</div>');
    elm.appendTo('#wrapper');
    elm.ckeditor();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜