How do you get the cursor position in a textarea?
If there is no selection, you can use the properties .selectionStart or .selectionEnd (with no selection they’re equal). var cursorPosition = $(‘#myTextarea’).prop(“selectionStart”); Note that this is not supported in older browsers, most notably IE8-. There you’ll have to work with text ranges, but it’s a complete frustration. I believe there is a library somewhere which … Read more