title: Is it possible to get the word under the mouse cursor in a `<textarea>`?
body: <p>Is it possible to get the word under the mouse cursor in a <code>&lt;textarea&gt;</code>?</p>
  
  <p>I have seen this question asked many times regarding text in <code>&lt;p&gt;</code> tags or similar html output tags, such as <a href="https://stackoverflow.com/questions/2444430/how-to-get-a-word-under-cursor-using-javascript">here</a>, but the <code>&lt;span&gt;</code> based solution doesn't work with a <code>&lt;textarea&gt;</code>, for obvious reasons.</p>
  
  <p>One approach I have considered is to fire a jQuery <code>click()</code> event to place the cursor and then use something like Tim Down's answere <a href="https://stackoverflow.com/questions/3053542/how-to-get-the-start-and-end-points-of-selection-in-text-area/3053640#3053640">here</a> to get the current word based on the cursor location. But a <code>click()</code> event doesn't seem to place the cursor at all.</p>
  
  <p>So that answer would be sufficient as well. How do I mimic a click event within a <code>&lt;textarea&gt;</code> so as to place the cursor at the current mouse position?</p>