Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to get char at current cursor position in textarea?

    Hi,
    I'd like to know how to get the character at the current cursor position in the textarea. I am new to Javascript and I couldn't find this on the internet. Please help.

    Thanks.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Actually, I don't believe there is any way to do that, which is cross-browser, if it's even possible. I could be wrong though, I'm not one of the better javascript gurus here.

    I do recall quite a few posts dealing with this subject from the old forum though, if I remember right this isn't possible?
    Last edited by whammy; 02-22-2003 at 03:51 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    In Gecko, this is trivial:

    Assume the variable textBox is a reference to the textbox:

    alert(textBox.value.charAt(textBox.selectionStart))



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •