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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding caret position in mozilla

    Hi,

    I'm doing a little script which adds some tags into a text in a textarea, and I can't get it to work fine on NS4 & mozilla. See for yourself: http://81.240.186.22/testform.html (click on "URL")

    In fact it seems to work, exept that it always adds the tags at the end of the text, instead of where the caret is. Any idea how it would be possible to get it working on those browsers?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using the search feature. I've seen this topic come up quite a few times.
    Moderator @ WebDeveloper.com
    Mentor @ WebXpertz.net

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    Ume, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Last edited by liorean; 10-14-2003 at 07:38 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what you are looking for is(Moz version only) :
    var oldStart=field.selectionStart;// gives the index of the cursor in the field if it's an insertion point
    var oldEnd=field.selectionEnd;// gives the end of selection range if it's a selected text
    NS4 - forget about it.


  •  

    Posting Permissions

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