php - Adding text formatting to textarea -


i've got textarea accepts html , sends message user types email. i'd go step further , make easier users no html knowledge further utilize textarea.

how go making textarea formatting @ top 1 in stackoverflow's ask question?

edit great answers, i've decided go hanoncs's answer that's straight forward. if likes better looking one, check out bakerstreet's answer.

in below demo, need click on text area before buttons enables.

<div id="sample">    <script type="text/javascript" src="http://js.nicedit.com/nicedit-latest.js"></script> <script type="text/javascript">  //<![cdata[    bklib.ondomloaded(function() {          new niceditor().panelinstance('area1');          new niceditor({fullpanel : true}).panelinstance('area2');          new niceditor({iconspath : '../niceditoricons.gif'}).panelinstance('area3');          new niceditor({buttonlist : ['fontsize','bold','italic','underline','strikethrough','subscript','superscript','html','image']}).panelinstance('area4');          new niceditor({maxheight : 100}).panelinstance('area5');    });    //]]>    </script>    <h4>      default (no config specified)    </h4>    <p>      new niceditor().panelinstance('area1');    </p>    <textarea cols="50" id="area1">  </textarea>    <h4>      available buttons {fullpanel : true}    </h4>    <p>      new niceditor({fullpanel : true}).panelinstance('area2');    </p>    <textarea cols="60" id="area2">  initial content in textarea  </textarea>    <h4>      change path icon file {iconspath : 'path/to/niceditoricons.gif'}    </h4>    <p>      new niceditor({iconspath : 'niceditoricons.gif'}).panelinstance('area3');    </p>    <textarea cols="50" id="area3">  </textarea>    <h4>      customize panel buttons/select list    </h4>    <p>      {buttonlist : ['fontsize','bold','italic','underline','strikethrough','subscript','superscript']}    </p>    <textarea cols="50" id="area4">  html content default in textarea  </textarea>    <h4>      set maximum expansion size (maxheight)    </h4>    <p>      {maxheight : 100}    </p>    <textarea style="height: 100px;" cols="50" id="area5">  html content default in textarea  </textarea>  </div>


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -