Javascript 如何将summernote的内容(文本)传递给a<;p>;标签
函数PasarValor(){ var htmlContent=$('#summernote')。summernote('code'); document.getElementById(“idTitulo”).innerHTML=$(htmlContent.text(); //document.getElementById(“idTitulo”).innerHTML=document.getElementById(“summernote”).value; }Javascript 如何将summernote的内容(文本)传递给a<;p>;标签,javascript,jquery,html,Javascript,Jquery,Html,函数PasarValor(){ var htmlContent=$('#summernote')。summernote('code'); document.getElementById(“idTitulo”).innerHTML=$(htmlContent.text(); //document.getElementById(“idTitulo”).innerHTML=document.getElementById(“summernote”).value; } bootstrap4 描述ENC
bootstrap4
描述ENCABEZADO。。。。
$('#summernote')。summernote({
工具栏:[
['style',['style']],
['font'、['bold'、'斜体'、'下划线'、'清除']],
['fontname',['fontname']],
['color',['color']],
[para',[ul',ol',段落]],
['height',['height']],
['help',['help']]
],
宽度:530,
});
首先,您应该将问题翻译成英语,第二个summernote有一个回调
属性,可以让您听到事件,因此在初始化过程中,您可以添加包含所需事件的回调
$('#summernote').summernote({
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['help', ['help']]
],
width: 530,
//add the callback with the event
callbacks: {
//listen to keyup
onKeyup: function() {
//lastly we get the editor html with $('#summernote').summernote('code') and paste it in the #idTitulo
$('#idTitulo').html($('#summernote').summernote('code'))
}
}
});
您好,请用英语发布您的问题,以便最大限度地理解您的问题,或者访问es stackoverflow:谢谢,这对我很有效,如果我用英语提问,这是我第一次问问题,我很抱歉。您能将所有内容和属性传递给(段落)吗例如,颜色?是,它将根据您在编辑器中写入的每一个选项更新te p,但它仅在键盘事件时更新。