【问题标题】:password view for all fields in a view视图中所有字段的密码视图
【发布时间】:2019-12-06 14:03:24
【问题描述】:

我有一个包含三个字段的表单,其中 PasswordFor razor 语法。

这是example的链接 当我专注于字段时,当我单击并注视该字段时,我可以看到密码。

当我在每个字段中单击一只眼睛时,我希望能够在没有星号的情况下看到所有三个字段。 我怎样才能做到这一点?

【问题讨论】:

    标签: html twitter-bootstrap razor model-view-controller


    【解决方案1】:

    你是不是这样除外

    $(".reveal").on('click',function() {
        var $pwd = $(".pwd");
        if ($pwd.attr('type') === 'password') {
            $pwd.attr('type', 'text');
        } else {
            $pwd.attr('type', 'password');
        }
    });
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
        <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <!------ Include the above in your HEAD tag ---------->
    
    <div class="container">    
      <div class="text-center">           
          <div class="col-md-8">
            <h2>Password show / hide click</h2> 
            <div class="input-group">
              <input type="password" class="form-control pwd" value="password">
              <input type="password" class="form-control pwd" value="password1">
              <input type="password" class="form-control pwd" value="password2" >     
           
          </div>     
            
                   <button style="float:right;" class="btn btn-default reveal" type="button"><i class="glyphicon glyphicon-eye-open"></i></button>
            </div>
      </div>  
    </div>

    【讨论】:

    • 是的,但我在 Chrome 中有一个内置的眼睛..如何移除文本框内的眼睛?
    • 我看不懂,你能解释清楚吗@Stefan0309
    • 当您在输入、chrome、edge 和其他浏览器中输入 `type='password' 时,会在每个文本字段中自动添加一个“眼睛”可点击图标。我可以抓住那个事件吗? ant 显示所有密码,从在该图标上按住鼠标?另外,我需要更改图标 on event on hoilding a mouse
    • 眼睛图标只能在IE和edge中看到。 chrome 中的默认眼睛图标尚未引入。几分钟前我问了这个问题。检查澄清。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-28
    • 2020-05-11
    相关资源
    最近更新 更多