Unable to add content to Textarea editor on Redactor 2. "Uncaught TypeError: Cannot read property 'code' of undefined"
<p>I have Redactor II (version 1.2.5) which I used to edit content on a database. When the page is loaded I load the content that needs to be edited, and I use the following code to add the content in to the Redactor editor:</p>

<pre><code>$('#eg_description').redactor('code.set', 'My text goes here');
</code></pre>

<p>However, when I load the page I get this error:</p>

<blockquote>
  <p>Uncaught TypeError: Cannot read property 'code' of undefined</p>
</blockquote>

<p>I've also tried this:</p>

<pre><code>$('#eg_description').redactor('this.code.set', 'My text goes here');
</code></pre>

<p>Which gives the following similar error:</p>

<blockquote>
  <p>Uncaught TypeError: Cannot read property 'this' of undefined</p>
</blockquote>

<p>Not entirely sure why it isn't working, so any help would be appreciated!</p>