The default value is nicEdit textarea

Here is the code

<?php if (isset($_POST['flag'])) { $length=strlen(trim($_POST['area'])); echo "Length of abstract : ".$length; if (!strlen(trim($_POST['area']))){ $abstractErrorMsg = "Please enter the abstract of your article"; echo $abstractErrorMsg; } } ?> <form method="post" action=""> <input type="hidden" name="flag" value="hidden"> <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript"> //<![CDATA[ bkLib.onDomLoaded(function() { nicEditors.editors.push( new nicEditor().panelInstance( document.getElementById('myNicEditor') ) ); }); //]]> </script> * Abstract <textarea name="area" id="myNicEditor" style="width: 300px;height: 100px;"></textarea> <input type="submit" name="btn"> </form> 

If I submit a form without entering any text in nicedit textarea, it shows length = 4. Why is this so? Is there a default value for nicedit textarea? If so, how to change it?

+4
source share
1 answer

Commenting out that 3 lines solve the problem. Find the code below in niceEdit.js. By default it contains <br /> .

 init : function() { this.elm.setAttribute('contentEditable','true'); //if(this.getContent() == "") { // this.setContent('<br />'); //} this.instanceDoc = document.defaultView; 
+4
source

All Articles