How to reset textarea with summernote

ScriptFolder picture ScriptFolder · Oct 17, 2014 · Viewed 11.9k times · Source

In a form after submitting all fields get cleared other than the TEXTAREA. I use summernote for textarea. (using bootstrap)

<script type='text/javascript'>//<![CDATA[ 
$(function(){
$('#description').summernote({height: 500});
});//]]>  
</script>

#description is the id of the textarea.

reset done like below

<script>
$('#submit-box')[0].reset();
</script>

#submit-box is the id of the form

Answer

Outsider picture Outsider · Oct 23, 2014
$('#description').code('');

see http://hackerwins.github.io/summernote/features.html#api-code

Updated

Since summernote v0.6.4+(maybe), the API has breaking changes.

$('#description').summernote('code', '');

http://summernote.org/getting-started/#get-amp-set-code