NicEdit WYSIWYG editor is one the best and smallest (code wise) WYSIWYG editors for the web out there. It has a very small code foot print and with just two lines of code you can convert any textarea element on you website in a nice looking rich text editor. NicEdit works on any element and not only textarea.
However, while using NicEdit on a textarea, you will have to take some other step in order to get the content of the textarea - as to whatever the user has entered. You may think, you can easily get the content entered in the textarea WYSIWYG editor of NicEdit in two ways:
var notes = $("div.nicEdit-main").html();
For this method to work you have to make sure that you have jQuery defined in your website / web app's sources. The value of the content in the textarea will be available in the notes variable above.
Using nicEdit Libraries
This method does not need jQuery to be included and works purely based on nicEdit's helper libraries that you have already included in order to initialize the nicEdit WYSIWYG editor on the desired textarea:
var nicInstance = nicEditors.findEditor('myID');
here, myID is the element ID pertaining to the textarea, for eg.
Now that, we have instantiated our editor, we can get its contents using this code snippet:
var notes = nicInstance.getContent();
Please let us know if you are facing any issues with nicEditor we can help you out.
Related Posts by Tags: content, nicedit, textarea