placeholder even if focus
Results 1 to 4 of 4

Thread: placeholder even if focus

  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    276

    placeholder even if focus

    Hi,

    I am using an input text in my PHP project for email address and password. I made the place holder for both so it will be easy for users to know what is every textbox form. but when I load the page the email address textbox will be autofocus therefore it will lose the placeholder then user needs to take the focus just to know what's this textbox?

    Is there anyway to keep the placeholder text even when the cursor is focused so it will only be disappeared when the user starts typing.


    Thanks
    Jassim

  2. #2
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,658
    The simplest way would be, do not autofocus on that element.

    If that's not acceptable, how about pre-setting the element value and select all text?

  3. #3
    Senior Member
    Join Date
    Oct 2011
    Posts
    276
    I need something like this:

    https://twitter.com/

    or this:

    https://www.twilio.com/login

  4. #4
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,889
    How about giving the textbox a label? There's an element for that. <label>.
    You can also look at, for example, the twilio page to see how they set their placeholder text (at a wild guess it's probably something to do with the "placeholder" attribute).
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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