1
<script src="/static/kindeditor/kindeditor-all.js"></script>
<script src="\static\jquery-3.3.1.min.js"></script>
$(function(){KindEditor.create(‘#detail‘,{ #找到标签生成文本编辑框 jquery转js 后面加上[0] 2 width:"100%", 3 height:"300px", 4 items:[‘source‘,‘preview‘,‘undo‘,‘redo‘,‘cut‘, 5 ‘copy‘,‘paste‘,‘link‘,‘image‘,‘fontsize‘,‘forecolor‘, 6 ], 7 resizeType:0, 8 afterBlur:function(){ #文本编辑数据同步到该标签,不然后台获取不到值 9 this.sync();}, 10 }) 11 })
1 function AjaxSend(){ 2 console.log($(‘#detail‘)[0].value); #jquery转js 后面加上[0] 或者$(‘#detail‘).val()
3 $.ajax({ 4 url:"/{{site}}/edit_blog", 5 type:‘POST‘, 6 data:{‘title‘:$(‘#title‘).val(),‘detail‘:$(‘#detail‘).val(),‘csrfmiddlewaretoken‘:‘{{csrf_token}}‘}, 7 success:function(arg){ 8 } 9 }) 10 }