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

jQuery中removeProp()方法用法實(shí)例

 更新時(shí)間:2015年01月05日 10:48:32   投稿:shichen2014  
這篇文章主要介紹了jQuery中removeProp()方法用法,實(shí)例分析了removeProp()方法的功能、定義及刪除由prop()方法設(shè)置的屬性時(shí)的使用技巧,需要的朋友可以參考下

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

此方法可以刪除由prop()方法設(shè)置的屬性。

語(yǔ)法:

復(fù)制代碼 代碼如下:
$("selector").removeProp(name)

參數(shù)列表:

參數(shù) 描述
name 定義要要?jiǎng)h除的屬性名稱。

實(shí)例:

實(shí)例一:

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="http://www.dbjr.com.cn/" />
<head>
<title>腳本之家</title>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
       $("td").prop({width:"200",height:"300"});
       $("button").click(function(){
           $("td").removeProp("width");
       })
    })
</script>
</head>
<body>
    <table border="1">
      <tr>
       <td>歡迎來(lái)到腳本之家</td>
      </tr>
    </table>
    <button>刪除屬性</button>
</body>
</html>

以上代碼可以刪除td的width屬性。

實(shí)例二:

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="http://www.dbjr.com.cn/" />
<head>
<title>腳本之家</title>
<style type="text/css">
   td
   {
       width:200px;
   }
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
       $("td").prop({height:"300"});
       $("button").click(function(){
            $("td").removeProp("width");
       })
    })
</script>
</head>
<body>
    <table border="1">
      <tr>
       <td>歡迎來(lái)到腳本之家</td>
      </tr>
    </table>
    <button>刪除屬性</button>
</body>
</html>

以上代碼并沒(méi)有刪除td的width屬性,這是因?yàn)閞emoveProp()只能刪除由prop()方法設(shè)置的屬性。

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

相關(guān)文章

最新評(píng)論