第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

jquery的remove()方法會將方法和數(shù)據(jù)移除,那么這個數(shù)據(jù)是指什么?

<html>

<head>

? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

? ? <style type="text/css">

? ? p{

? ? ? ? border: 1px solid red;

? ? }

? ? </style>

? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>

</head>

<body>

? ? <h3>給頁面2個p元素節(jié)點綁定點擊事件,點擊后彈出自己本身的節(jié)點內(nèi)容</h3>

? ? <p id="p1">元素p1,同時綁定點擊事件</p>

? ? <p>元素p2,同時綁定點擊事件</p>

? ? <h3>通過點擊2個按鈕后觀察方法處理的區(qū)別</h3>

? ? <button>點擊通過remove處理元素p1</button>

? ? <button>點擊通過detach處理元素p2</button>

</body>

<script type="text/javascript">

? ? $("p").on("click",function(e){

? ? ? ? alert(e.target.innerHTML);

? ? });

? ? $("button:first").on("click",function(){

? ? ? ? var p = $("p:first").remove();

? ? ? ? alert(p.attr("id"));

? ? ? ? p.css("color","red").text("remove后事件也消失了");

? ? ? ? $("body").append(p);

? ? });

? ? $("button:eq(1)").on("click",function(){

? ? ? ? var p = $("p:eq(1)").detach();

? ? ? ? $("body").append(p);

? ? });

</script>

</script>

</html>

我給p加了id,我remove后將該對象的idalert了一下,還是可以出來,我比較好奇所說的數(shù)據(jù)是指什么?

正在回答

1 回答

這個問題很深,涉及到j(luò)s內(nèi)存處理機(jī)制。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

jquery的remove()方法會將方法和數(shù)據(jù)移除,那么這個數(shù)據(jù)是指什么?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號