.replaceWith( newContent ):用提供的内容替换集合中所有匹配的元素并且返回被删除元素的集合 返回被删除元素的集合怎么体现出来?
小白
小白 2016-12-19 17:37:30
0
2
987
小白
小白

好好学习,天天向上!!!

reply all(2)
数据分析师

.replaceWith( newContent ): Replace all matching elements in the collection with the provided content and return the collection of deleted elements. How to return the collection of deleted elements? -PHP Chinese website Q&A-.replaceWith(newContent): Replace all matching elements in the collection with the provided content and return the collection of deleted elements. How to return the collection of deleted elements? -PHP Chinese website Q&A

Please watch and learn.

迷茫

设置一个变量用.replaceWith( newContent )返回值赋值就可以看到被删除元素了,比如例子中添加del变量如下:

 var del = $(".right > div:first p:eq(1)").replaceWith('<a style="color:red">replaceWith替换第二段的内容</a>');

        document.write(del.html());

可以看到打印“第二段”就是返回值了


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template