【问题标题】:summernote is showing html code after retrieving from Mysql DB从 Mysql DB 检索后,summernote 显示 html 代码
【发布时间】:2016-04-11 01:07:54
【问题描述】:

我使用的是 Summernote 所见即所得编辑器,我在编辑器中编写了一些内容,然后将其保存在 Mysql DB 中,现在当我使用 php 从 DB 检索内容并将其回显到 Summernote 时,编辑器显示 html 代码而不是如我们在所见即所得上看到的格式化内容,请为此提供一些解决方案。 我的代码:

 <textarea id="summernote" class="form-control" placeholder="Article" name="article_content"><?php echo $article_content; ?></textarea>

    <script src="summernote-0.7.0-dist/dist/summernote.min.js"></script>
    
    <script>
$(document).ready(function() {
	$('#summernote').summernote({
		height: "300px"
	});
});
var postForm = function() {
	var content = $('textarea[name="article_content"]').html($('#summernote').code());
}
    </script>

【问题讨论】:

    标签: php html mysql summernote


    【解决方案1】:

    想法很好,问题是你如何获取数据。

    您应该使用$('#summernote').summernote('code') 获取数据,然后在 div/text 区域中回显

    【讨论】:

      猜你喜欢
      • 2021-12-26
      • 2015-12-09
      • 2016-11-14
      • 2016-04-01
      • 2016-01-24
      • 1970-01-01
      • 2015-09-12
      • 1970-01-01
      • 2014-08-14
      相关资源
      最近更新 更多