Is there a way to have a textarea fire an event if the user changes which line the caret is on, say, by clicking or using the up/down arrows? Or is this just not possible in Javascript? I’ve found ways to find/set the current position of the caret, but that’s not what I need…
Share
Sounds like you need to register a couple events for your text area. off the top of my head, a click event, and a keypress event with multiple keycode values. Do you need to use pure javascript, or do you have some javascript libraries to utilize?
Do you need help registering events? or do you need help finding the caret position during one of the events? (see andy’s link for that) or is the answer to both my questions "yes"?
edit
ok, from you’re comments you’re ok with jquery, and the fieldselection plugin prevents you from re-inventing the wheel.
//jQuery 1.7
referenced stack overflow.
reference to get .split() regex