国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery中removeProp()方法用法實例

2019-11-20 13:29:36
字體:
來源:轉載
供稿:網友

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

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

語法:

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

參數列表:

參數 描述
name 定義要要刪除的屬性名稱。

實例:

實例一:

復制代碼 代碼如下:

<!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://m.survivalescaperooms.com/" />
<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>歡迎來到武林網</td>
      </tr>
    </table>
    <button>刪除屬性</button>
</body>
</html>

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

實例二:

復制代碼 代碼如下:

<!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://m.survivalescaperooms.com/" />
<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>歡迎來到武林網</td>
      </tr>
    </table>
    <button>刪除屬性</button>
</body>
</html>

以上代碼并沒有刪除td的width屬性,這是因為removeProp()只能刪除由prop()方法設置的屬性。

希望本文所述對大家的jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 华安县| 吉木乃县| 沅江市| 尼玛县| 荆州市| 平度市| 泰宁县| 永安市| 长垣县| 静海县| 什邡市| 靖宇县| 五家渠市| 邵东县| 博客| 准格尔旗| 浦县| 射洪县| 辰溪县| 布尔津县| 定兴县| 孟州市| 平阴县| 大庆市| 徐汇区| 承德县| 恭城| 疏附县| 黎平县| 永州市| 调兵山市| 合水县| 巴东县| 图片| 永春县| 开化县| 嵊泗县| 宁夏| 辽宁省| 梅州市| 马公市|