jQuery中:password选择器用法实例
本文实例讲述了jQuery中:password选择器用法,分享给大家供大家参考。具体分析如下:
此选择器能够选取所有密码框。
语法结构:
$(":password")
实例代码:
<!DOCTYPEhtml> <html> <head> <metacharset="utf-8"> <metaname="author"content="https://www.nhooo.com/"/> <title>毛票票</title> <scripttype="text/javascript"src="mytest/jQuery/jquery-1.8.3.js"></script> <scripttype="text/javascript"> $(document).ready(function(){ $("#btn").click(function(){ $(":password").css("background-color","red"); }) }) </script> </head> <body> <ul> <li>密码框:<inputtype="password"name="mima"/></li> </ul> <buttonid="btn">点击查看效果</button> </body> </html>
希望本文所述对大家的jQuery程序设计有所帮助。