View Full Version : how to get character before cursor

03-16-2004, 12:28 PM
I am trying to work out a way of returning the character BEFORE the cursor position using an onkeypress command.

for example:


if the pipeline above is the cursor - when the user types the next letter, I want to be able to get the letter before that. So in this case, the script would return "h"

I've tried using some of the following commands:

var code = iView.document.selection;
var tmp = code.createRange();


but nothing seemed to work.

any help is much appreciated.... thanks :)

Willy Duitt
03-16-2004, 02:15 PM
Try the forum Search (http://www.codingforums.com/search.php?s=). This question was asked and resolved approximately a month ago. I'm sure you will find your answer there.


03-16-2004, 02:18 PM
oh god!! It was me that asked the question as well!!!

:rolleyes: :rolleyes: :rolleyes:


sorry about that!!!! :eek: