How to call doit() from the textArea instead of <div>

Trying to get so the TextArea will call doit() when new text is entered .

Pretty new to javascript & html. do not really know what this does

input type="submit" name="_action_checkText"

   function doit() {
             tinyMCE.activeEditor.execCommand("mceWritingImprovementTool", "en-US");
          }


  <textarea id="checktext" name="text" onkeyup="doit()" style="width: 100%" rows="6">
  	Paste your own text here... or check check this text.</textarea>



  <div>
      <input type="submit" name="_action_checkText"
          value="Check Text" onClick="doit();return false;">
  </div>

Do you want to trigger a new check of the text whenever the user presses any key? That’s not that easy, it would flood the server with requests. You’d have to develop some logic to prevent too many requests.

I was thinking to only add when the user would press the spacebar.

I would rather have the user not have to click “check spelling”. Not sure whats the logic behind Microsoft word. But something like that.

won’t help if text is edited through backspace/delete.
my idea: add a ten-seconds timer that is triggered when checked text is edited (making the text unchecked)
when it reaches 0 call doit()
this should limit the calls to a maximum of 0.1 Hz. (and reduce the chance of false positives due to checking a sentence in progress.)