限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery密码输入框带显示隐藏明文密码特效代码

所属分类: 网页特效-其它&杂项    2023-11-22 04:19:00

jquery密码输入框带显示隐藏明文密码特效代码 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery密码输入框带显示隐藏明文密码特效代码(共2个文件)

    • show-hide-password.js
    • index.html

使用方法

(function($) {
  'use strict';
  $.fn.showHidePassword = function(option) {
    $.extend(this, option);

    var element = $(this);

    // Check bootstrap input group
    var inputGroupCheck = element.parent().hasClass('input-group');

    if (inputGroupCheck) {
      element.css({
        borderTopRightRadius: '4px',
        borderBottomRightRadius: '4px'
      });
    } else {
      element.wrap('<div class="password-container"></div>');
    }

    element.after('<span class="show-hide-password"><i class="fa fa-eye"></i></span>');

    // Add postion css password container
    $('.password-container').css({position: 'relative'});

    var showHideIcon = element.parent().find('.show-hide-password');

    // Add eye icon css
    $(showHideIcon).css({
      position: 'absolute',
      display: 'none',
      top: '0',
      right: '0',
      height: element.outerHeight(true) - 2,
      marginTop: '1px',
      padding: '6px 11px',
      //borderLeft: '1px solid #CCC',
      cursor: 'pointer',
      zIndex : '999',
      color : 'black'
    });

    // Show eye icon when you start entering password
    element.keyup(function(event) {
      var keyUp = $(this);
      var passwordVal = keyUp.val();

      if (passwordVal.length > 0) {
        // Add padding password input
        keyUp.css({paddingRight : '34px'});

        if (inputGroupCheck) {
          $(showHideIcon).css({padding: '8px 11px'});
        }

        // Show eye icon
        keyUp.parent().find(showHideIcon).show();
      } else if (element.val() == '') {
        // If is empty hide eye icon
        keyUp.parent().find(showHideIcon).hide();
      }
    });

    // If is not empty show eye icon
    element.trigger('keyup');

    // Change eye icon class
    $(showHideIcon).on('click', function() {
      var iconElement = this;

      // Change eye icon
      $(iconElement).find('i').toggleClass('fa-eye fa-eye-slash');

      var findInputPassword = $(iconElement).parent().find('input');
      var passwordFieldType = findInputPassword.attr('type');

      // Show Hide Password
      if (passwordFieldType == 'password') {
        findInputPassword.attr('type', 'text');
      } else {
        findInputPassword.attr('type', 'password');
      }
    });
  }
})(window.jQuery);

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 其它&杂项

jquery点击文本框自动切换动态背景色特效

鼠标点击input文本框自动切换页面背景色,每一个文本框触发不同颜色!
  其它&杂项
 1379  0

jqcloud标签云插件_热门城市文字标签云代码

鼠标hover移到标签上显示数据统计,很实用的特效!
  其它&杂项
 4265  0

jquery当浏览器切换到其它标签页时更改标题

这是一款浏览器标签选项卡切换特效,当浏览器中的选项卡切换到其它页面时,页面标题自动变更为设置的文本文字。
  其它&杂项
 2250  0

纯CSS创建的土黄色沙丘背景图片特效

一款css创建的沙漠沙丘背景特效,弯曲重叠的沙丘,非常的壮观好看。
  其它&杂项
 7388  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论