textarea doesn't clear totally?
<p>This code should clear the textarea when there is only spaces and breaklines but it leaves a breakline if you only press enter... I suspect my code that makes enter sendComment and shift+enter breakline for being the misbehaving part...</p>

<p><strong>Javascript:</strong></p>

<pre><code>&lt;script type='text/javascript'&gt; 
function sendComment(id) 
{ 
  var comMessage = $("#com"+id); 

  var cmessage = comMessage.val(); 

  cmessage = cmessage.replace(/(\r\n|\n|\r)/gm,""); 
  cmessage = cmessage.split(' ').join(''); 

  if(cmessage == "") 
  { 
    $("#comstatus"+id).html("&lt;br&gt;&lt;b style='color:red;border:2px solid red;'&gt;Please type a message&lt;/b&gt;&lt;br&gt;&lt;br&gt;").show().fadeOut(6000); 
    $('#com'+id).text(cmessage); 
    $('#com'+id).val(cmessage); 
    $("#com"+id).html(cmessage); 
    $("#com"+id).attr("value", cmessage); 
  }
} 
&lt;/script&gt; 
</code></pre>

<p>code for making enter send message and making shift+enter break line</p>

<pre><code>    &lt;script type='text/javascript'&gt; 
    &lt;!--  
    var isShift=null;  
    var isNN = (navigator.appName.indexOf("Netscape")!=-1);  
    var OP = (navigator.appName.indexOf("Opera")!=-1);  
    if (OP) isNN=true;  

    var key;  
    function shift(event){  
      key = (isNN) ? event.which : event.keyCode;  
      if (key==16)isShift=1;  
    }  

    function process(event,id){  
      key = (isNN) ? event.which : event.keyCode;  
      if(document.layers&amp;&amp;event.modifiers==4){  
        isShift=1;  
      }  
      if (key==13&amp;&amp;isShift!=1){  
        sendComment(id);  
      }   
      if (key!=16) isShift=null;  
    }  
    //--&gt;  
    &lt;/script&gt;
</code></pre>

<p><strong>HTML:</strong></p>

<pre><code>&lt;textarea onkeypress='process(event, $idMe)' onkeydown='shift(event)' onfocus='commentboxfocus($idMe)' onblur='commentboxblur($idMe)' class='text' id='com$idMe' wrap='hard'  style='wrap:hard;height:30px;width:100%;position:relative' name='comment'&gt;Type a comment!&lt;/textarea&gt;
</code></pre>

<p>Hope you can help me! Thanks in advance!</p>
