Blogs Hub

by AskGif | Oct 18, 2018 | Category :coding

How to get WYSIHTML5 textarea content cleared?

How to get WYSIHTML5 textarea content cleared?

<p>I have got a text area having id ="myTextArea", I'm able to fetch the content of text area but I'm not able to clear the content once the user successfully submits the data. I'm using a wysihtml5 plugin as my text editor. my code is as follows.</p> <pre class="language-markup"><code>&lt;textarea name="def_text" id="myTextArea" class="textarea"&gt;&lt;/textarea&gt;</code></pre> <p>in my jquery file, I'm doing as follows once the user successfully submits the data.</p> <pre class="language-markup"><code>$('#myTextArea').val('');</code></pre> <p>but it is not clearing the text area. I've tried $('#myTextArea').html('') too , but it is not working for me.</p> <p>&nbsp;</p> <p>Solution:</p> <p>Try using the following line that worked for me.</p> <pre class="language-markup"><code>$('#myTextArea').data("wysihtml5").editor.clear();</code></pre> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p>

read more...