title: How do I make undo/redo in <textarea> to react on 1 word at a time, word by word or character by character?
body: <p>How do I make undo/redo in textarea to react on 1 word at a time, word by word or character by character? Not to all at once.</p>
  
  <p>Right now this function I have works but it reacts to all the words in the textarea at once and that is the wrong way to function in my case. I need it to react word by word and not all words at once, so that it works like a text editor. I am using Chrome, and I need it to work word by word or character by character for any web browser or at least for the major ones.</p>
  
  <p><strong>NOTE:</strong> Do not advice me to use editable div because in this case editable div I can not use with the other functions I have on the page. I need it for <code>&lt;textarea&gt;</code> and nothing else.</p>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  function Undo() { document.execCommand("undo", false, null); }
  function Redo() { document.execCommand("redo", false, null); }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;input type="button" onmouseup="Undo();CopyTextDivText();" value=" &amp;laquo;--&amp;laquo; Undo " /&gt;
  &lt;input type="button" onmouseup="Redo();CopyTextDivText();" value=" Redo &amp;raquo;--&amp;raquo; " /&gt;
  &lt;textarea name="text" id="text" class="content" rows="34" cols="104" wrap="soft"&gt;&lt;/textarea&gt;
  </code></pre>