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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為啥我的代碼點(diǎn)擊之后沒有效果呢

<!doctype html>

<html>

?<head>

? <meta charset="UTF-8">

? <meta name="Generator" content="EditPlus?">

? <meta name="Author" content="">

? <meta name="Keywords" content="">

? <meta name="Description" content="">

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

? <title>Document</title>

? <style>

? ? ?.content{width:300px;}

.append{background-color:blue;}

.appendTo{background-color:red;}

? </style>

?</head>

?<body>

? <h2>通過(guò)append與appendTo添加元素</h2>

? <button id="bt1">點(diǎn)擊通過(guò)jQuery的append添加元素</button>

? <button id="bt2">點(diǎn)擊通過(guò)jQuery的appendTo添加元素</button>

? <div><div>

? <script type="text/javascript">

? $("#bt1").on("click",function(){

? ? ?$(".content").append('<div>通過(guò)append方法添加的元素</div>')

? })

? <script type="text/javascript">

? ? ?$("#bt2").on("click",function(){

? $('<div>通過(guò)appendTo方法添加的元素</div>').appendTo($(".content"))

})

? </script>

? </script>

?</body>

</html>


正在回答

3 回答

<script type="text/javascript">

? $("#bt1").on("click",function(){

? ? ?$(".content").append('<div>通過(guò)append方法添加的元素</div>')

? })

? <script type="text/javascript">----------------------------

? ? ?$("#bt2").on("click",function(){

? $('<div>通過(guò)appendTo方法添加的元素</div>').appendTo($(".content"))

})

? </script>--------------------------------

? </script>

1:首先你這個(gè)標(biāo)簽放置有問題,<script>標(biāo)簽不應(yīng)該是包含關(guān)系。你可以選擇把我后面加虛線的那段刪除,或者調(diào)整標(biāo)簽的位置。



??$(".content").append('<div>通過(guò)append方法添加的元素</div>')

2:這段代碼是向類content的后面增加HTML代碼,但是你的HTML主體內(nèi)容中,找不到content的類。

應(yīng)該在如下這段代碼的div中增加類名content ,不然找不到需要被添加的位置,怎么可能看到結(jié)果呢

<button id="bt1">點(diǎn)擊通過(guò)jQuery的append添加元素</button>

? <button id="bt2">點(diǎn)擊通過(guò)jQuery的appendTo添加元素</button>

? <div class="content"><div>



望采納,祝進(jìn)步

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

</script>兩個(gè)放一起了

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


.content
是div的class,少寫了,所以加不上去

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

舉報(bào)

0/150
提交
取消

為啥我的代碼點(diǎn)擊之后沒有效果呢

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

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

幫助反饋 APP下載

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

公眾號(hào)

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