How can I catch the event of "cursor place change" inside textarea with jQuery (also should working in IE6)?
Example1:
Before :text |
After : te|
Example2:
Before :text |
After : text tex|t2
Example3:
Before :text |
After : |
Edit:
After catching the event of cursor- need also to check if cursor change his position (also have to work for IE6)
Edit2:
If you have solution that will not work in IE6 but in IE7+webkit please write it
There are essentially three events that can cause a cursor to change position,
keystrokes
mouse clicks
programmatic events like paste, select, focus...
I would capture those events for whatever it is you are trying to accomplish with 'cursor place change'
code sample added:
$("#myTextInput").bind("keydown click focus", function() {
alert("Current position: " + $(this).caret().start);
});
Thanks to @Nick Craver
I've found that the select event seems to cover all changes to caret position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With