Connecting Tech Pros Worldwide Help | Site Map

Get Caret Position (FireFox)

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 3rd, 2005, 01:35 PM
ryanmhuc@yahoo.com
Guest
 
Posts: n/a
Default Get Caret Position (FireFox)

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


  #2  
Old November 3rd, 2005, 01:45 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Get Caret Position (FireFox)



ryanmhuc@yahoo.com wrote:
[color=blue]
> Is there a way to get the caret position of a text input using FireFox.[/color]

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.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.