The content of this article is about the jQuery rich text plug-in: how to use the wangEditor plug-in, which has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Rich text is often used during development. The wangEditor recorded today is also a very easy-to-use rich text plug-in. How to use the picture directly:
1. First download the plug-in. You can download it from Baidu yourself
2. Introduce the plug-in file (two js, one css)
3 , and then define the rich text editor in the js code
<script type="text/javascript"> var E = = window.wangEditor r var editor = new E('#editor') // 或者 var editor = new E( E( document.getElementByItById('editor') ) editor.customConfig.uploadImgServServer = '上传图片url'; editor.customConfig.uploadFileNameName = '上传图片文件夹名'; editor.customConfig.uploadImgMaxSMaxSize = 图片限制大小; editor.customConfig.uploadImgHeadHeaders = { 'Accept' : 'multipart/form-data' }; editor.customConfig.debug=tru=true; editor.create() () var editor_value=$('.content').html(); editor.txt.html(edi(editor_value); </script>
where uploadImgServer is the interface for uploading images in text content, and uploadFileName is the folder name for uploading images in the root directory. uploadImgMaxSize is to define the maximum size of uploaded images
After filling in these configurations, add the following code where the rich text box needs to be inserted:
<p id="editor"></p>
The id in p must be editor, Then write editor.create() in js to create a rich text box. The effect is as follows:
Related recommendations:
Javascript event delegation code implementation and code Optimization
Detailed case explanation: Introduction to dynamic programming (taking stair climbing as an example)
How to use simple js code to implement carousel scrolling Effect?
The above is the detailed content of jQuery rich text plug-in: How to use the wangEditor plug-in. For more information, please follow other related articles on the PHP Chinese website!