TinyMCE: How do I prevent `<br data-mce-bogus=“1”>` text in editor?

徘徊边缘 提交于 2019-12-05 04:02:50

I recently had this problem, inline: true would not work with a textarea. I change mine to a div and it now works as expected.

Actually, the "bogus" br tags appear for inline divs, too. They are added whenever the input field is empty. There appears to be no easy way to get rid of them. I use a CSS rule during the preview phase:

br[data-mce-bogus="1"] {
  display:none;
}

And then strip them out if they make it to the server when the user tries to save.

Are you using the tinymce jQuery package? The same thing was happening to me until I tried using the normal tinymce package instead.

<script>
$(document).ready(function () {
    $("#comment").ready(function () {
        $("#comment").val("")
    })

})
</script>

I add this jquery script in html to solve this bug.

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