Clearing the textarea after changing the value
<p>I am selecting a text on textarea and replacing it with newtext "shan"..The problem when I click on the submit button still the old text is submitted instead of new text..</p>

<p>But this problem doesn't come when I press spacebar on keyboard and then press Submit button..</p>

<p>I can see the replaced text in "TextArea" but when I submit it the only the old text gets submitted..</p>

<pre><code>     var replacement text="shan";
    if (window.getSelection) {
       sel = window.getSelection();

    if (sel.rangeCount) {
        range = sel.getRangeAt(0);
        var e1=range.startContainer;
        var e2=e1.getElementsByTagName('textarea');
        e2[0].value=replacementText;
            e1.focus();
        }
     }    
</code></pre>
