Possible Duplicate:
How to get caret position in textarea?
If i type * in anywhere in the html textarea control i need to get the current position on keyup event like "Welcome* to jQuery". So i have * after Welcome means at 8th position. Let me know if anybody can help me on this.
This will work. (note: with quotes it’s at 8 else at 7)
http://jsfiddle.net/Vandeplas/hc6ZH/
UPDATE: solution with multiple *
http://jsfiddle.net/Vandeplas/hc6ZH/1/
UPDATE: giving only the position of the * char you just typed
http://jsfiddle.net/Vandeplas/esDTj/1/