課程
/前端開發(fā)
/jQuery
/jQuery基礎(chǔ)(二)—DOM篇
1:div為什么沒有雙標(biāo)簽
2:$(this)代表誰? ?$(this).text()返回的class值是什么?
2017-11-08
源自:jQuery基礎(chǔ)(二)—DOM篇 5-3
正在回答
$('a').wrap(function()?{???????????? ?????return?'<div?class="'?+?$(this).text()?+?'"?/>';???????? ?})
匿名函數(shù)function返回(return)一個值:'<div class="' + $(this).text() + '" />';$(this)為當(dāng)前選擇的a元素,即$('a'),所以div的class也就是“a元素”,
$(this).text()="a元素",很明顯期望的最后結(jié)果是<div class="a元素"/>
慕仙5237505 提問者
風(fēng)飄葉搖 回復(fù) 慕仙5237505 提問者
慕仙5237505 提問者 回復(fù) 風(fēng)飄葉搖
Richard_Li
夜闌臥聽風(fēng)吹雨y
舉報
jQuery第二階段開啟DOM修煉,了解創(chuàng)建、插入、刪除與替換
3 回答return '<div class="' + $(this).text() + '" />';?
3 回答return '<div class="' + $(this).text() + '" />';什么意思?
2 回答關(guān)于<div class="' + $(this).text() + '" />
3 回答<div class="' + $(this).text() + '" />存在的意義
4 回答求解!關(guān)于class="div"下的li!
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-11-09
匿名函數(shù)function返回(return)一個值:'<div class="' + $(this).text() + '" />';
$(this)為當(dāng)前選擇的a元素,即$('a'),所以div的class也就是“a元素”,
$(this).text()="a元素",很明顯期望的最后結(jié)果是<div class="a元素"/>