Get Caret Position (FireFox)

R

ryanmhuc

Is there a way to get the caret position of a text input using FireFox.
I am aware of ways to such with IE but have been unable to accomplish
in FireFox and have not found a solution in the groups or web. Anyone?
Thanks
 
M

Martin Honnen

Is there a way to get the caret position of a text input using FireFox.

For textControls in Firefox/Mozilla you can read out
textControl.selectionStart
textControl.selectionEnd
selectionEnd should be the caret position.
To change the selection you can use
textControl.setSelectionRange(newSelectionStart, newSelectionEnd)

Opera 8 also supports those properties/methods on text controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top