javascript - Clear out Redactor WYSIWYG - Stack Overflow

We have a redactor editor which we populate from the database but once we have submitted the data back

We have a redactor editor which we populate from the database but once we have submitted the data back we need to clear the textarea.

We have tried various binations but are unable to clear it out.

jQuery("#redactor").redactor('set', '');

AND

jQuery("#redactor").val("");

We have a redactor editor which we populate from the database but once we have submitted the data back we need to clear the textarea.

We have tried various binations but are unable to clear it out.

jQuery("#redactor").redactor('set', '');

AND

jQuery("#redactor").val("");
Share Improve this question edited May 24, 2014 at 21:22 filype 8,42010 gold badges46 silver badges69 bronze badges asked May 24, 2014 at 21:13 PerryWPerryW 993 silver badges12 bronze badges 3
  • It looks like you could .redactor('selectionAll') then .redactor('selectionRemove'). Other options might be insertText or insertHtml. – Jared Farrish Commented May 24, 2014 at 21:23
  • once we have submitted the data back.....Can you post it in your question above? – Jai Commented May 24, 2014 at 21:25
  • The code you provide is jQuery("#redactor").redactor('set', ''); is actually working on the redactor demo page. imperavi./redactor Clears the visual view and the textarea too. – Oliver Commented Jul 10, 2014 at 13:10
Add a ment  | 

4 Answers 4

Reset to default 5
$("#redactor").redactor('code.set', ''); 

updated version

With Redactor version 3, I had to use below code in order to clear redactor textareas:

$('.redactor-in').html('');

Note: This clears all redactor textareas in the current page, one need to change the class name .redactor-in inside the jQuery DOM selector if they want to clear specific textareas and leave some.

As you are working with the DOM you can just clear the innerHTML

$('.redactor_editor').html('');

Source: How to clear input or HTML or text on the redactor wysiwyg editor?

There's also some more documentation on http://imperavi./redactor/docs/api/

$('#redactor').redactor('insertHtml', 'your code');

you can use this code sample for RedactorX

$('.rx-editor p').html("")

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745426297a4627193.html

相关推荐

  • javascript - Clear out Redactor WYSIWYG - Stack Overflow

    We have a redactor editor which we populate from the database but once we have submitted the data back

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信