tag but after jQuery library. How do you get the cursor position in a textarea? jQuery solutions preferred unless JavaScript is as simple or simpler. var currentCursorPosition = $("#textbox").currentCursorPosition(); function setCaretToPos (input, pos) {. Now I will explain how Calling focus will select the existing content, using this plugin will put the cursor at the end, allowing the user to begin typing right away while preserving the content. @John Thanks for the description. You have to use the jQuery val() function as given in the example below. Get cursor position (in characters) within a text Input field. I am working on a small function where you can enter HTML tags with text between them onclick. var cursorPosition = $('#myTextarea').prop("selectionStart"); Note that this is not supported in older browsers, most notably IE8-. jQuery function to set the cursor position to a specfic character position within an input field. This is a very simple lightweight plugin to allow you to move the caret (or cursor) position in an or