如何在文本字段中设置用户名和密码的标签? [英] How to set labels inside textfields for username and password?

查看:236
本文介绍了如何在文本字段中设置用户名和密码的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站有登录表单。此登录表单有两个文本字段,用户名和密码。目前我在文本字段之前放置标签(用户名,密码)。但现在我想删除这两个标签,并希望在文本字段中显示文本(用户名,密码)。当用户关注这些文本字段时,应删除文本,用户可以输入他想要的用户名和密码。

I have a login form for my website. This login form have two text fields, username and password. Currently I am placing labels(username, password) just before textfields. But now I want to removed these two labels and want to show text(username, password) inside textfield. When user focuses on these textfields then texts should be removed and user can enter his desired username and password.

我还注意到,当用户打开登录表单然后字体颜色填写在textfield(用户名,密码)中的文本(用户名,密码)的颜色不同,当用户开始在该字段中输入时,之前的文本被删除,新的字体颜色为黑色。

I have also noticed that when user open a login form then font color of text(username, password) populated in textfield(username, password) is of diffent color and when user start typing in that field then previous text is removed and new font color is black.

怎么可能?

推荐答案

你可以使用jQuery插件,比如这个一个或者这个 one

You can use a jQuery Plugin such as this one or this one

这些可以满足您的需要,我认为它们也支持单独的样式水印。

These do what you need and i think they both also support a separate style for the watermark.

这篇关于如何在文本字段中设置用户名和密码的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆