0

how to get current cursor position from multiline textbox without selection of any data from the textbox.

  • http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea Is this what you want? – luiges90 Jan 07 '13 at 13:17
  • Please check this question: http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea – Hui Zheng Jan 07 '13 at 13:17

1 Answers1

0

This vanilla JS DEMO should get you started.

var textArea = document.getElementsByTagName('textarea')[0];

function mouseMove(e) {
  var x = e.pageX - textArea.offsetLeft,
      y = e.pageY - textArea.offsetTop;

  textArea.value = x + ", " + y;
}

textArea.addEventListener('mousemove', mouseMove, false);
Brian Ustas
  • 57,129
  • 3
  • 24
  • 20