Use of the Nicedit Rich Text Editor in Web projects
Why should I use a rich text editor?
First of all, the Rich text editor, the normal HTML input or textarea tags can only be simple input, and do not have other text adjustment function, even
Even the space and carriage return to write another tool class to identify, not to mention the font size and color changes, the overall layout is functional. In fact, the general reading of the type of text input box is required
To Rich text editor, yes, you usually write a blog with a rich text editor. If you still can't understand the difference between rich text and normal input boxes, see:
Second, why to choose Nicedit
Similar Rich text editor has many, here choose Nicedit not because it is how good, but it is not comprehensive, it is not very good-looking,
However, it has several great advantages: good compatibility, simple and lightweight, suitable as a background manager of the input box.
Iii. Methods of Use
1. Download the Nicedit toolkit with the following contents in the package
2. Copy the Nicedit.js and niceditoricons.gif files to the Web project and place them in the static resource location
3. Modify the position of Niceditoricons.gif in the project in Nicedit.js
4. In the JSP code is as follows (note to modify the path of JS):
5. Get the value of the rich text input, note that here with TEXTAREA ID and value is not get, because Nicedit will hide the original textarea, and generate the input box, which is to get inside the box
The text needs to be obtained by its generated class name, and the code is implemented as follows:
I am here to facilitate the direct submission of the form, the button event triggered directly to the rich text in the value obtained, and assigned to the form of the hidden input.
Here Nicedit Rich Text can achieve the purpose of use, the need for a file only a JS file and a picture, is not really very light is very simple? So, in just a simple text editing function
, consider using this rich text editor. Share finished, thank you for reading.
Use of the Nicedit Rich Text Editor in Web projects