湛江网站建设详细策划,wordpress链接指向本地,怎么做网站访问截取ip,wordpress 支持 反对1、detach#xff08;#xff09; detach() 方法移除被选元素#xff0c;包括所有文本和子节点。这个方法会保留 jQuery 对象中的匹配的元素#xff0c;因而可以在将来再使用这些匹配的元素。detach() 会保留所有绑定的事件、附加的数据#xff0c;这一点与 remove() 不同…1、detach detach() 方法移除被选元素包括所有文本和子节点。这个方法会保留 jQuery 对象中的匹配的元素因而可以在将来再使用这些匹配的元素。detach() 会保留所有绑定的事件、附加的数据这一点与 remove() 不同。 !DOCTYPE html
html langen
headmeta charsetUTF-8titleDocument/titlestylep{margin: 6px;background: yellow;}p.off{background: red;}/style
/head
bodyphello/phow arepyou?/pbutton按钮/button
/body
script srclibs/jquery-1.8.3.min.js/script
script typetext/javascript$(function(){$(p).click(function(){$(this).toggleClass(off);})var p;$(button).click(function(){if(p){p.appendTo(body);p null;}else{p $(p).detach();console.log(p);}})});
/script
/html 2、remove 将匹配元素集合从DOM中删除。同时移除元素上的事件及 jQuery 数据。 !DOCTYPE html
html langen
headmeta charsetUTF-8titleDocument/titlestylep{margin: 6px;background: yellow;}p.off{background: red;}/style
/head
bodyphello/phow arepyou?/pbutton按钮/button
/body
script srclibs/jquery-1.8.3.min.js/script
script typetext/javascript$(function(){$(p).click(function(){$(this).toggleClass(off);})var p;$(button).click(function(){if(p){p.appendTo(body);p null;}else{p $(p).remove();console.log(p);}});//移除 》加上点击没反应绑定的事件失效});
/script
/html 3、empty移除匹配元素的所有子节点 4、unwrap:将匹配元素集合的父级元素删除保留自身和兄弟元素如果存在在原来的位置。转载于:https://www.cnblogs.com/gao-xiong/p/5933284.html