<p>I'm not 100% sure I follow, but I think this is what you are looking for.</p>

<p>In your javascript file, you'll want <code>code.set</code></p>

<p><a href="https://imperavi.com/redactor/docs/api/code/" rel="nofollow">API Reference</a></p>

<pre><code>...

$('#yourTextArea').redactor('code.set', your.data);
</code></pre>

CC BY-SA 3.0
2016-10-08T11:33:45.440Z
Ignore my last example in the question. I actually wanted to get the code/text out the the editor/textarea, not set the code. But this works too.
iNalgiev
CC BY-SA 3.0
2016-10-07T02:42:57.443Z
2016-10-07T02:42:57.443Z
Damon
<p>I'm building a plugin for Craft CMS. This plugin will load on the edit/content page, where the standard Redactor WYSIWYG editor will be loaded too (by CraftCMS).
I want to get the HTML/text contents of the Redactor editor.</p>

<p>For example <code>tinymce.activeEditor.getContent()</code> will get the HTML contents of the <strong>TinyMCE</strong> editor in WordPress.</p>

<p>How do I achieve this in Craft CMS?</p>

<p>The API documentation says <code>var text = this.clean.getPlainText(html);</code>.
But how do I know reference to <strong>this</strong>.</p>

<redactor><javascript><content><editor>
I want to get the HTML/text contents of the Redactor editor
# I want to get the HTML/text contents of the Redactor editor

(Asked by: username_0 on 2016-10-06)

I'm building a plugin for Craft CMS. This plugin will load on the edit/content page, where the standard Redactor WYSIWYG editor will be loaded too (by CraftCMS).
I want to get the HTML/text contents of the Redactor editor.

For example `tinymce.activeEditor.getContent()` will get the HTML contents of the **TinyMCE** editor in WordPress.

How do I achieve this in Craft CMS?

The API documentation says `var text = this.clean.getPlainText(html);`.
But how do I know reference to **this**.

**Tags:** redactor, javascript, content, editor


---

## 1 answers

### Answer by username_1 on 2016-10-07. Score: 2 | Accepted answer

I'm not 100% sure I follow, but I think this is what you are looking for.
In your javascript file, you'll want code.set
API Reference
...

$('#yourTextArea').redactor('code.set', your.data);

> **Comments:**
> **username_0**: Ignore my last example in the question. I actually wanted to get the code/text out the the editor/textarea, not set the code. But this works too.  

---

