【发布时间】:2023-03-18 22:13:01
【问题描述】:
如果加载时存在,我希望 Summernote 显示内容。但是在代码视图中初始化期间,我无法将变量的值加载到 Summernote 中。
代码如下:
$(document).ready(function() {
$('.summernote').on('summernote.init', function () {
$('.summernote').summernote('codeview.activate');
}).summernote({
height: 300,
placeholder: 'Paste content here...',
codemirror: {
theme: 'monokai'
}
}).summernote('code', '<?php echo isset($profiledata["Profile"])?$profiledata["Profile"]:"" ?>');
});
<form>
<div class="form-group">
<label for="summernote"><strong>Paste the HTML code here:</strong></label>
<textarea class="summernote" name="profile" id="profile"> </textarea>
</div>
<button type="submit" class="btn btn-success" id="submitButton">Submit</button>
</form>
我发布了适合我的解决方案。但是,我欢迎任何建议。谢谢,
【问题讨论】:
-
这个问题和 PHP 有什么关系?
-
在 textarea 中添加 data-plugin="summernote"
-
@MagnusEriksson 问题已编辑。
-
@NimsPatel 试过了。不工作
标签: javascript php jquery summernote