這篇文章主要介紹了jQuery中:password選擇器用法,實例分析了:password選擇器的功能、定義與匹配密碼框的使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了jQuery中:password選擇器用法,分享給大家供大家參考。具體分析如下:
此選擇器能夠選取所有密碼框。
語法結構:
復制代碼代碼如下:
$(":password")
實例代碼:
復制代碼代碼如下:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.49028c.com/" />
<title>武林網</title>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn").click(function(){
$(":password").css("background-color","red");
})
})
</script>
</head>
<body>
<ul>
<li>密碼框:<input type="password" name="mima" /></li>
</ul>
<button id="btn">點擊查看效果</button>
</body>
</html>
希望本文所述對大家的jQuery程序設計有所幫助。