Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset textarea with summernote

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

like image 776
ScriptFolder Avatar asked Oct 17 '14 12:10

ScriptFolder


2 Answers

$('#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

like image 112
Outsider Avatar answered Oct 04 '22 12:10

Outsider


another way :

$('#description').summernote('reset');
like image 30
Igor Monteiro Avatar answered Oct 04 '22 11:10

Igor Monteiro