删除节点

remove any dom you hate

作者
IBAS0742
日安装量
0
总安装量
2
评分
0 0 0
版本
1.0.3
创建于
2024-09-08
更新于
2024-09-08
大小
19.0 KB
许可证
MIT
适用于
所有网站

删除任何不喜欢的页面元素

Index 名称 作用
删除 删除选定元素
隐藏 隐藏选定元素
跳过 跳过选定元素
qAll 多选
删除 删除记录
选择器 xpath路径
const xpath = "选择器";
// const qAll = "all";
const dom1 = document.querySelectorAll(xpath);
// const qAll = "single";
const dom2 = [document.querySelector(xpath)];

dom1.forEach(dom => {
    // ①
    dom.remove();
    // ②
    dom.style.display = 'none';
    // ③
    // 无操作
})
  • 上:上一级元素(父级节点)
  • 下:子节点
  • 左:下一个兄弟节点
  • 右:上一个兄弟节点

ctrl + q 打开面板

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址