How to reset textarea with summernote
Asked Answered
P

2

5

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

Petrography answered 17/10, 2014 at 12:46 Comment(0)
V
10
$('#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

Vi answered 23/10, 2014 at 16:11 Comment(0)
R
5

another way :

$('#description').summernote('reset');
Requital answered 29/1, 2016 at 11:33 Comment(2)
That is the documented method, but I can't get it to work, hence why I'm here.Magnification
Turns out I had an older version...whoops.Magnification

© 2022 - 2024 — McMap. All rights reserved.