How to reset textarea with summernote

无人久伴 提交于 2019-12-22 07:57:57

问题


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


回答1:


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




回答2:


another way :

$('#description').summernote('reset');


来源:https://stackoverflow.com/questions/26425342/how-to-reset-textarea-with-summernote

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!