欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中:disabled選擇器用法實(shí)例

 更新時(shí)間:2015年01月04日 14:54:42   投稿:shichen2014  
這篇文章主要介紹了jQuery中:disabled選擇器用法,實(shí)例分析了:disabled選擇器功能、定義及選取所有禁用的表單元素的技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery中:disabled選擇器用法。分享給大家供大家參考。具體分析如下:

此選擇器能夠選取所有禁用的表單元素。

語法結(jié)構(gòu):

復(fù)制代碼 代碼如下:
$(":disabled")

此選擇器一般也要和其他選擇器配合使用,比如類選擇器、元素選擇器等等。

復(fù)制代碼 代碼如下:
$("input:disabled").css("background-color","red");

以上代碼能夠?qū)⒉豢捎玫膇nput元素的背景色設(shè)置為紅色。
實(shí)例代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.dbjr.com.cn/" />
<title>腳本之家</title>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("input:disabled").css("background-color","red");
  });
});
</script>
</head>
<body>
<ul>
  <li>
    不可用文本框:<input type="text" name="zhuanqu" disabled="disabled" />
    可用的文本框:<input type="text" name="keyong" />
  </li>
</ul>
<button>點(diǎn)擊查看效果</button>
</body>
</html>

希望本文所述對大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論