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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Place caret at the beginning of the field.

    Hi,

    The solution I am looking for is posted by mcpDESIGNS at stackoverflow

    What I wish to have, is forcing the caret position back to 0 as soon as the field is focused.

    I have created a fiddle which will help demonstrate what I'm doing.

    fiddle: http://jsfiddle.net/KuLTU/

    I assume the way I'm calling setCaretPosition is wrong, any suggestion ?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    You should just be using placeholder attribute to show the hint text.

    Code:
    <input type="text" id="search_string" placeholder="Search..." />
    For browsers not supporting this attribute (IE 9 and below), there's a lot of plugins out there.


  •  

    Posting Permissions

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