CKEditor附加textarea

时间:2013-02-28 12:08:43

标签: javascript jquery ckeditor

我需要使用CKEditor初始化一个新的textarea,我已经阅读了4版本的文档,但我还不明白该怎么做...

var form='<form id="editel_form" method="post" action="function.php" enctype="multipart/form-data" target="hidden_upload" onsubmit="javascript:upload_started()" class="formcor"><ul class="formconte">';                               
form+="<li class='cont'>Element Category: <br/><select id='de_cat' name='de_cat'></select>";                                
form+="<li class='cont'>Element New Name:<br/> "+data['id']+"<input type='text' id='de_name' name='de_name' value='"+data['title']+"'/></li>";                          
form+="<li class='cont'>Element Current Image:<br/><img src='"+data['image']+"' /></li>";                           
form+="<li class='cont'>Element New Image:<br/><input id='de_image' name='de_image' type='file' /></li>";
form+="<li class='cont'>Element New Price:<br/> <input type='text' id='de_price' name='de_price' value='"+data['price']+"' /></li>";
form+="<li class='cont'>Element New Position:<br/> <input type='text' id='de_pos' name='de_pos' value='"+data['position']+"' /></li></ul>";
form+="<ul class='textar'><li>Description:<br/><textarea id='de_desc' name='de_desc' class='ckeditor'>"+data['description']+"</textarea></li></ul>";
form+="<img src='css/loader.gif' class='loadingimg' /><input type='submit' id='sub_edit' name='sub_edit' value='Submit Changes' class='sendval' submit='return false;'/></form>";
$('#elementstable').after($('#elementstable')).append(form);$('#d_cat > option').clone().appendTo('#de_cat');
$("#d_cat option:selected").attr('selected','');
$("#d_cat option[value='"+data['category']+"']").attr('selected','selected');
new CKEDITOR.dom.node($('#de_desc'));

1 个答案:

答案 0 :(得分:1)

基本上用JS调用CKEDITOR.replace( 'de_desc' )See docs