PerryW
PerryW

Reputation: 99

Clear out Redactor WYSIWYG

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 combinations but are unable to clear it out.

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

AND

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

Upvotes: 2

Views: 3146

Answers (4)

Zahidul
Zahidul

Reputation: 76

you can use this code sample for RedactorX

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

Upvotes: 0

MugoTech
MugoTech

Reputation: 11

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.

Upvotes: 1

Venkatesan
Venkatesan

Reputation: 178

$("#redactor").redactor('code.set', ''); 

updated version

Upvotes: 5

filype
filype

Reputation: 8390

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.com/redactor/docs/api/

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

Upvotes: 0

Related Questions