当前位置 : 首页 » 编程语言 » 正文

jQuery中:password选择器用法实例

分类 : 编程语言 | 发布时间 : 2018-04-21 09:06:21 | 浏览 : 0

本文实例讲述了jQuery中:password选择器用法,分享给大家供大家参考。具体分析如下:

此选择器能够选取所有密码框。

语法结构:

复制代码 代码如下:
$(":password")

实例代码:

复制代码 代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.jb51.net/" />
<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程序设计有所帮助。

相关阅读:

Remove duplicates from an array of objects in JavaScript

Can I call jquery click() to follow an <a> link if I haven't bound an event handler to it with bind or click already?

Check whether a string matches a regex in JS

jQuery event to trigger action when a div is made visible

Check if user is using IE with jQuery

Resize HTML5 canvas to fit window

How do I replace a character at a particular index in JavaScript?

JavaScript file upload size validation

Converting a string to a date in JavaScript

How to get the data-id attribute?