我可以得到< input type = text>看起来像< input type = password&gt ;? [英] Can I get <input type=text> to look like <input type=password>?

查看:205
本文介绍了我可以得到< input type = text>看起来像< input type = password&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理一个令人沮丧的Internet Explorer问题,阻止我将 jquery-validate jquery-placeholder 。简而言之,验证不适用于 type = password 的字段。

I'm trying to deal with a frustrating Internet Explorer issue that prevents me from using jquery-validate in conjunction with jquery-placeholder. In short, the validation does not work on fields with type=password.

一个可能的修复我想出了是修改我的密码为 type = text ,但这当然显示的密码以纯文本,而不是 *******

One possible fix I came up with is to modify my passwords to be type=text, but this of course displays the passwords in plain-text rather than as *******.

有没有聪明的 html / js / css 技巧使 text 好像他们密码 s

Is there any clever html/js/css trick to make text fields display as though they were passwords?

推荐答案

有一个模拟密码值的隐藏输入类型

Have a hidden input type that simulates the password values

所以我想jquery聪明的是

So I guess jquery wise it would be

//everytime the password changes hidden changes with it.
$('#passwordId').change(function() {
 $('#hiddenID').val() = $('#passwordId').val();
});

html:

<input type="password" id="passwordId" />
<input type="hidden" id="hiddenID" />

因此,这将允许您验证与密码相同的隐藏输入。

So this would allow you to validate the hidden input which would be the same value as the password.

这篇关于我可以得到&lt; input type = text&gt;看起来像&lt; input type = password&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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