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

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

改成before也沒顯示多參數(shù)???

<!DOCTYPE?html>
<html>

<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title></title>
????<script?src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
????<style>
????.test1?{
????????background:?#bbffaa;
????}
????
????.test2?{
????????background:?yellow;
????}
????</style>
</head>

<body>
????<h2>通過insertBefore與insertAfter添加元素</h2>
????<button?id="bt1">點擊通過jQuery的insertBefore添加元素</button>
????<button?id="bt2">點擊通過jQuery的insertAfter添加元素</button>
????<div?class="aaron">
????????<p?class="test1">測試insertBefore,不支持多參數(shù)</p>
????</div>
????<div?class="aaron">
????????<p?class="test2">測試insertAfter,不支持多參數(shù)</p>
????</div>
????<script?type="text/javascript">
????$("#bt1").on('click',?function()?{
????????//在test1元素前后插入集合中每個匹配的元素
????????//不支持多參數(shù)
????????$(".test1").before($('<p?style="color:red">測試insertBefore方法增加</p>','<p?style="color:red">多參數(shù)</p>'))
????})
????</script>
????<script?type="text/javascript">
????$("#bt2").on('click',?function()?{
????????//在test2元素前后插入集合中每個匹配的元素
????????//不支持多參數(shù)
????????$('<p?style="color:red">測試insertAfter方法增加</p>',?'<p?style="color:red">多參數(shù)</p>').insertAfter($(".test2"))
????})
????</script>
</body>

</html>


正在回答

1 回答

$(".test1").before($('<p?style="color:red">測試insertBefore方法增加</p>','<p?style="color:red">多參數(shù)</p>'))

before后面應(yīng)該直接放html代碼,而不是jquery對象。去掉$(),就可以了。

$(".test1").before('<p?style="color:red">測試insertBefore方法增加</p>','<p?style="color:red">多參數(shù)</p>')

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

keveon 提問者

非常感謝!
2016-12-17 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

改成before也沒顯示多參數(shù)?。?/h1> 我要回答 關(guān)注問題

微信客服

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

幫助反饋 APP下載

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

公眾號

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