密码字段中的Jquery默认值 [英] Jquery default value in password field

查看:69
本文介绍了密码字段中的Jquery默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此Jquery插件来填充输入文本,这些文本在点击时消失。它对于密码字段并不理想,因为所有内容都显示为点。在开始输入之前,在密码字段中显示默认文本的好方法是什么?

I am using this Jquery plugin for populating inputs with text that disappears on click. It isn't ideal for password fields because everything shows up as dots. What would be a good way to make a default text visible in password fields before you start typing?

推荐答案

通过JS,我的回答和@ ultimatebuster的相同。然而,整个JS路线都是hacky,现在替代品开始出现了。许多现代浏览器现在直接通过HTML5支持这个东西:

Through JS, my answer would be the same as @ultimatebuster's. However, the whole JS route is hacky, now that alternatives started appearing. Many modern browsers now support this thing directly through HTML5:

<input type="password" name="password" placeholder="Enter password"/>

(许多现代浏览器=除了Internet Explorer之外的每个主要浏览器。我拒绝为其编码;如果你必须在IE中拥有相同的东西,你必须走黑客的路线。)

(Many modern browsers = every major one except the Internet Explorer. I refuse to code for it; if you have to have the same thing in IE as well, you'll have to go the hacky route.)

这篇关于密码字段中的Jquery默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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