before()
根據(jù)參數(shù)設(shè)定,在匹配元素的前面插入內(nèi)容:
before: function() { return this.domManip( arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } }); }
類(lèi)似after只是替換了第二個(gè)參數(shù),改變插入的位置。
append()
在每個(gè)匹配元素里面的末尾處插入?yún)?shù)內(nèi)容:
append: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } }); }
內(nèi)部增加節(jié)點(diǎn),直接可以調(diào)用appendChild方法。
prepend()
prepend: function() { return this.domManip( arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } }); },
類(lèi)似after只是替換了第二個(gè)參數(shù),改變插入的位置。
請(qǐng)驗(yàn)證,完成請(qǐng)求
由于請(qǐng)求次數(shù)過(guò)多,請(qǐng)先驗(yàn)證,完成再次請(qǐng)求
打開(kāi)微信掃碼自動(dòng)綁定
綁定后可得到
使用 Ctrl+D 可將課程添加到書(shū)簽
舉報(bào)