jquerynicedit

nicedit post value br only


I am using two nicedit text boxes.

<script type="text/javascript" src="http://js.nicedit.com/nicEdit.js"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
    new nicEditor({buttonList : ['fontSize','bold','italic','underline','ol','ul','strikeThrough','subscript','superscript','forecolor','bgcolor']}).panelInstance('area3');
    new nicEditor({buttonList : ['fontSize','bold','italic','underline','ol','ul','strikeThrough','subscript','superscript','forecolor','bgcolor']}).panelInstance('area4');
    nicEditors.findEditor('area4').saveContent();
    nicEditors.findEditor('area3').saveContent();
    });
</script>
  <font color="black"><textarea class="form-control" name="area4" cols="50" id="area4"></textarea></font></div></div><br>

<font color="black"><textarea class="col-xs-12" cols="50" name="area3" id="area3"><?php echo $basic_info;?></textarea></font></div></div><br>

area3 have static data which comes from other variable. I have issue with area4. It is not sending data in post. When i check data in post. i found area4 - <br>

I tried to fix it but not able to find any issues.

Does anyone ever encountered the same earlier.


Solution

  • First one, you initialize nicedit twice.

    Better way is

    var NicEditor = new nicEditor({buttonList :['fontSize','bold','italic','underline','ol','ul','strikeThrough','subscript','superscript','forecolor','bgcolor']});
    
    NicEditor.panelInstance('area3');
    NicEditor.panelInstance('area4');
    

    And yes you got a < br > because nicedit write a < br > at initialization into its window. Take a look in the nicedit.js