How do I get the current position of the cursor in a TEXTAREA using Javascript?

Asked by Frank Peterson a design student from New York

How do I get the current position of the cursor in a TEXTAREA using Javascript? I’ve only found scripts on inserting at the current position but not on returning the number of the cursor’s position.

(more…)