Create textarea into a rich content/text editor using jQuery

  • 3 years-4 months

    Create textarea into a rich content/text editor using jQuery

    • Category : jquery
    • Viewed : 88 times
    • Posted On :
    • Posted by : Guley

    You can Create textarea into a rich content/text editor using jQuery.

    /***Footer part***/
    <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
    <script type="text/javascript">
            bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); // convert all text areas to rich text editor on that page
    
            bkLib.onDomLoaded(function() {
                 new nicEditor().panelInstance('area1');
            }); // convert text area with id area1 to rich text editor.
    
            bkLib.onDomLoaded(function() {
                 new nicEditor({fullPanel : true}).panelInstance('area2');
            }); // convert text area with id area2 to rich text editor with full panel.
    </script>
    /***HTML PART***/
    <!DOCTYPE html>
    <html>
    <head>
      <title>How to Create textarea into a rich content/text editor using jQuery</title>  
     
      <script type="text/javascript">
    //<![CDATA[
      bkLib.onDomLoaded(function() {
            new nicEditor({maxHeight : 200}).panelInstance('area');
            new nicEditor({fullPanel : true,maxHeight : 200}).panelInstance('area1');
      });
      //]]>
      </script>
    </head>
    <body>
    <h4>How to Create textarea into a rich content/text editor using jQuery</h4>
    <div id="sample">
      <h4>Simple textarea</h4>  
      <textarea name="area" id="area" style="width:70%;height:200px;">
           Some Initial Content was in this textarea
      </textarea>
      <h4>textarea with complete panel</h4>
      <textarea name="area1" id="area1" style="width:70%;height:200px;">
           Some Initial Content was in this textarea
      </textarea>
    </div>
    </body>
    </html>

Report this or Ask your own question

Your Answer

When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.