How to reset textarea with summernote

2019-05-03 10:08发布

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

2条回答
放荡不羁爱自由
2楼-- · 2019-05-03 10:14

another way :

$('#description').summernote('reset');
查看更多
对你真心纯属浪费
3楼-- · 2019-05-03 10:21
$('#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

查看更多
登录 后发表回答