title: How do I find the current location of the cursor in a text box using jQuery?
body: <p>I'm using the code from <a href="https://stackoverflow.com/questions/1411557/jquery-keypress-event-get-text/1411608#1411608">this answer</a>:</p>
  
  <pre><code>$("input[x]").keypress(function (e) {
      var c = String.fromCharCode(e.which);
      //process the single character or
      var textValue = $("input[x]").val();
      var fulltext = textValue + c;
      //process the full text
  });
  </code></pre>
  
  <p>A comment noted that this assumes the cursor is at the end of the text box. I tried searching how to get the location of the cursor for solution of this issue, but could not figure out how to do it?</p>
  
  <p>How does one find the current location of the cursor?</p>