W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
用來刪除由.prop()方法設置的屬性集
隨著一些內置屬性的DOM元素或window對象,如果試圖將刪除該屬性,瀏覽器可能會產生錯誤。jQuery第一次分配undefined值的屬性,而忽略了瀏覽器生成的任何錯誤
要刪除的屬性名
設置一個段落數字屬性,然后將其刪除。
<p> </p>
var $para = $("p");
$para.prop("luggageCode", 1234);
$para.append("The secret luggage code is: ", String($para.prop("luggageCode")), ". ");
$para.removeProp("luggageCode");
$para.append("Now the secret luggage code is: ", String($para.prop("luggageCode")), ". ");
The secret luggage code is: 1234. Now the secret luggage code is: undefined.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: