基於bootstrap的富文本編輯器summernote的用法

初次用到這個工具,在取值這步就掉坑裏了,很多文章寫的取值是

 var content = $('#summernote').summernote('code');我只能說我是半天取不了值,還以爲是取到的值格式有問題...總之用這行代碼我是沒有取到正確的值的。

正確的操作代碼如下:


取值:  var comment=$(".summernote").code()

賦值: $(".summernote").code(data.comment)

置空: $(".summernote").code('')

初始化:$('.summernote').summernote({

                      height: 200, // set editor height

                      minHeight: null, // set minimum height of editor

                      maxHeight: null, // set maximum height of editor

                      focus: false // set focus to editable area after initializing summernote

                    })

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章