Zepto实现密码的隐藏/显示
程序员文章站
2023-12-28 10:05:22
效果图:
代码如下:
效果图:
代码如下:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>document</title> <script type="text/javascript" src="http://www.xipwang.cn/js/zepto.min.js"></script> </head> <body> <div class="ui-password"> <input type="password" name="" class="passwords"> <button class="seepassword" >查看密码</button> </div> <script type="text/javascript"> $(function(){ (function(){ $.fn.showpassword = function () { //查看密码 function seepasswrod(elemnts) { this.elemnts = elemnts; this.init(); }; seepasswrod.prototype = { init: function () { var m = this this.shouevent(m); }, shouevent: function (m) { m.elemnts.on("tap click", function () { var type = m.elemnts.parent().find(".passwords").attr("type"); if (type == "password") { m.elemnts.parent().find(".passwords").attr("type", "text"); } else if (type == "text") { m.elemnts.parent().find(".passwords").attr("type", "password"); } }); }, }; return this.each(function () { new seepasswrod($(this)) }); }; })(zepto); $(".seepassword").showpassword(); }); </script> </body> </html>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!
推荐阅读
-
Zepto实现密码的隐藏/显示
-
shell - php的cli如何实现读取用户输入,但隐藏这段字符输出
-
使用foreach和volist标签分别实现模板数据的分页显示-2018年6月1日11点30分
-
scroll事件实现监控滚动条并分页显示(zepto.js)
-
关于jq显示隐藏的成效
-
静态页面也可以实现预览 列表不同的显示方式[原创]_javascript技巧
-
yii实现CheckBox复选框在同一行显示的方法,yiicheckbox
-
shell - php的cli如何实现读取用户输入,但隐藏这段字符输出
-
基于Maya API和PySide2的插件开发(用TextBrowser实现文件信息的显示)
-
微信小程序左滑动显示菜单功能的实现