<small id='OA9SA'></small><noframes id='OA9SA'>

      <legend id='OA9SA'><style id='OA9SA'><dir id='OA9SA'><q id='OA9SA'></q></dir></style></legend>

          <bdo id='OA9SA'></bdo><ul id='OA9SA'></ul>
      1. <i id='OA9SA'><tr id='OA9SA'><dt id='OA9SA'><q id='OA9SA'><span id='OA9SA'><b id='OA9SA'><form id='OA9SA'><ins id='OA9SA'></ins><ul id='OA9SA'></ul><sub id='OA9SA'></sub></form><legend id='OA9SA'></legend><bdo id='OA9SA'><pre id='OA9SA'><center id='OA9SA'></center></pre></bdo></b><th id='OA9SA'></th></span></q></dt></tr></i><div id='OA9SA'><tfoot id='OA9SA'></tfoot><dl id='OA9SA'><fieldset id='OA9SA'></fieldset></dl></div>
        <tfoot id='OA9SA'></tfoot>

        “将密码显示为文本"控制

        quot;Show password as textquot; control(“将密码显示为文本控制)
        <i id='ZPpb9'><tr id='ZPpb9'><dt id='ZPpb9'><q id='ZPpb9'><span id='ZPpb9'><b id='ZPpb9'><form id='ZPpb9'><ins id='ZPpb9'></ins><ul id='ZPpb9'></ul><sub id='ZPpb9'></sub></form><legend id='ZPpb9'></legend><bdo id='ZPpb9'><pre id='ZPpb9'><center id='ZPpb9'></center></pre></bdo></b><th id='ZPpb9'></th></span></q></dt></tr></i><div id='ZPpb9'><tfoot id='ZPpb9'></tfoot><dl id='ZPpb9'><fieldset id='ZPpb9'></fieldset></dl></div>
        <tfoot id='ZPpb9'></tfoot>

        <small id='ZPpb9'></small><noframes id='ZPpb9'>

          • <legend id='ZPpb9'><style id='ZPpb9'><dir id='ZPpb9'><q id='ZPpb9'></q></dir></style></legend>
              <bdo id='ZPpb9'></bdo><ul id='ZPpb9'></ul>

                <tbody id='ZPpb9'></tbody>
                • 本文介绍了“将密码显示为文本"控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个常用的登录表单,其中包含两个输入字段,一个用于登录,一个用于密码.我目前正在尝试添加一个控件,它将输入的密码显示为纯文本,以便用户可以检查它是否有错别字.

                  I have a usual login form consisting of two input fields, one for login, one for password. I am currently trying to add a control that will show entered password as plain text, so user can check it for typos.

                  问题是浏览器(至少是 Firefox)不允许动态更改输入字段的 type 属性,所以我不能只将 type="password" 更改为type="text".另一个问题是浏览器不允许获取密码字段的值,所以我不能创建一个新的 input type="text" 并将其值设置为密码的值.我见过几种不同的方法来完成这项任务,包括 这个,但它们只有在输入密码时才能工作,并且在浏览器自动填充密码时失败.

                  The problem is that browsers (at least Firefox) do not allow dynamic changing of type attribute of input fields, so I cannot just change type="password" to type="text". Another problem is that browsers do not allow to get value of password field, so I can't create a new input type="text" and set its value to the password's one. I've seen several different approaches to this task, including this one, but they are working only if the password is typed and fail when browser autofills the password.

                  因此,欢迎提出任何建议.我正在使用 jQuery.

                  So, any suggestions to do this are welcome. I am using jQuery.

                  推荐答案

                  你可以这样做:

                  <input type="password" id="password">
                  <input type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'"> Show password
                  

                  这篇关于“将密码显示为文本"控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                  AngularJs. Is it possible to deselect HTML “radio” input by click?(AngularJs.是否可以通过单击取消选择 HTML“收音机输入?)
                  Checking Value of Radio Button Group via JavaScript?(通过 JavaScript 检查单选按钮组的值?)

                      <tfoot id='9uEHr'></tfoot>
                          <tbody id='9uEHr'></tbody>
                        <legend id='9uEHr'><style id='9uEHr'><dir id='9uEHr'><q id='9uEHr'></q></dir></style></legend>

                        <small id='9uEHr'></small><noframes id='9uEHr'>

                          <bdo id='9uEHr'></bdo><ul id='9uEHr'></ul>
                            <i id='9uEHr'><tr id='9uEHr'><dt id='9uEHr'><q id='9uEHr'><span id='9uEHr'><b id='9uEHr'><form id='9uEHr'><ins id='9uEHr'></ins><ul id='9uEHr'></ul><sub id='9uEHr'></sub></form><legend id='9uEHr'></legend><bdo id='9uEHr'><pre id='9uEHr'><center id='9uEHr'></center></pre></bdo></b><th id='9uEHr'></th></span></q></dt></tr></i><div id='9uEHr'><tfoot id='9uEHr'></tfoot><dl id='9uEHr'><fieldset id='9uEHr'></fieldset></dl></div>