× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

update wysihtml5 editor content dynamically using jQuery.

Dec 04, 2014
<p>Using <a href="http://xing.github.com/wysihtml5/">wysihtml5 editor</a> you can update the editor content in realtime but it's a bit tricky and you can't do it directly via the textarea element of jQuery. So, the following won't work -</p><pre><code class="language-javascript">// doesn't work $('#textarea-id').val('new content');</code></pre><p>Instead, you will have to use the editor's api method setValue() as the following example - </p><pre><code class="language-javascript">// assuming you have instantiated the editor previously using $('#textarea-id').wysihtml5() $('#textarea-id').data("wysihtml5").editor.setValue('new content');</code></pre><p> </p>
comments powered by Disqus