jQuery/javascript - Input fields (user,pass) just like twitter's login?

后端 未结 6 752
萌比男神i
萌比男神i 2021-01-21 13:14

How can I achieve the same effect like twitter\'s log-in form (the top on the right) - when you click on the username/pass the value \"username\" stays there until you enter tex

6条回答
  •  野性不改
    2021-01-21 13:50

    here is a novel and easy idea for simple log in forms, until the html5 "placeholder" is better supported: We all know you cant change password fields to text, so showing default text is tricky, or you need another hidden input box.

    Why not use a background image?? On focus set to none, and then on blur, if the value is empty, put it back. Very easy and well supported. The only drawback is that your default text is not text, but an image. I can't think of anything that this would effect negatively, as far as usability.

提交回复
热议问题