完全删除html元素 [英] Deleting completely a html element

查看:84
本文介绍了完全删除html元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 .remove(),我正在使用它并且工作正常,我的意思是它删除了我想要的元素。但我认为它不会永久消除它。右键单击浏览器窗口选择查看页面源,我仍然可以看到这些已删除的元素。
我想完全删除它们或永久地说。
请帮忙。

I am aware of .remove() , I am using it and its working fine, I mean its removing the element which I want. But I think it doesn't removes it permanently. On right clicking in browser window selecting View page source I am still able to see those removed elements. I want to remove them completely or say permanently. Please help.

推荐答案

.remove()删除他们完全。您仍然在视图页面源中看起来的原因是页面源不会基于javascript更改。页面源显示页面在首次加载时的原始状态,而不是当前的状态。

.remove() removes them completely. The reason you still seem then in the view page source is because the page source does not change based on javascript. The page source shows how the page originally looked when it was first loaded, not how it currently is.

如果查看开发人员控制台,您会发现它们是不再存在。

If you look in the developers console, you will see that they are no longer there.

同样,如果使用javascript / jquery动态添加新元素,它将不会在页面源中显示该元素。

Likewise, if you dynamically add a new element with javascript/jquery, it will not show that element in the page source.

这篇关于完全删除html元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆