title: Format a text in the textbox
body: <p>I am trying to format a selected text to bold inside a textbox but not happening. However, it is hapenning in a span/div. My code</p>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt; 
  &lt;title&gt;Untitled Document&lt;/title&gt; 
  &lt;script type="text/javascript"&gt; 
  function FormatSelectedWord(txtBox,style) 
  { 
  
  var selectedText = document.selection 
  ? document.selection.createRange().text 
  : txtBox.value.substring(txtBox.selectionStart,txtBox.selectionEnd); 
  
  if(selectedText!='') 
  { 
  var newText='&lt;'+style+'&gt;'+selectedText+'&lt;/'+style+'&gt;'; 
  txtBox.value=txtBox.value.replace(selectedText,newText) 
  spOutput.innerHTML=txtBox.value; 
  } 
  } 
  &lt;/script&gt; 
  &lt;/head&gt; 
  &lt;body&gt; 
  
  
  &lt;input type="text" name="txtBox"&gt; &lt;/input&gt; 
  &lt;input type="button" value="Bold" onclick="FormatSelectedWord(txtBox,'b')"&gt; 
  &lt;span id="spOutput"&gt;&lt;/span&gt; 
  &lt;/body&gt; 
  &lt;/html&gt; 
  </code></pre>
  
  <p>Is it possible to do it insde a textbox. If so how?</p>
  
  <p>Thanks</p>