完全从源中删除标记 [英] Completly remove a tag from the source

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

问题描述

我想删除类别为.de的标记。

I would like to remove a tag with the class of '.de'.

$('。de')。remove( ); 会将其从页面中删除但是当我检查源代码时,我仍然会看到标记。

$('.de').remove(); will remove it from the page but when I check the source code, then I still see the tag.

我遇到的问题是,需要从表单中删除以下标记,否则它将被发送,而这不是我想要的。

The problem that I have is, the following tag needs to be removed from the form, otherwise it will get sent and that's not what I want.

<input class="input_field_left de" name="friend_vorname[]" type="text" placeholder="Vorname">

或者还有另外一种方法可以不让这个字段被发送?!

Or maybe there is another way to not let this field get sent?!

推荐答案

这就是查看源在浏览器中的工作原理。它向您显示来自服务器的内容(通常从服务器重新查询它[可能从缓存中读取]),页面中当前的内容。

This is just how "view source" works in browsers. It shows you what came from the server (and usually re-queries it from the server [which may read it from cache]), not what is currently in the page.

要查看页面中当前的内容,您需要在浏览器的开发工具中使用元素或DOM选项卡(通常通过F12或Ctrl + Shift + I打开)。您通常可以通过右键单击页面上的元素并选择Inspect element来打开它并移动到特定元素,因此如果您在 $('。de')之后使用表单执行此操作.remove(); 运行后,你会看到没有 .de 元素的表单。

To see what's currently in the page, you need to use the "Elements" or "DOM" tab in your browser's dev tools (usually opened via F12 or Ctrl+Shift+I). You can usually open it and move to a specific element by right-clicking that element on your page and choosing "Inspect element", so if you do that with your form after your $('.de').remove(); is run, you'll see the form without the .de elements in it.


我遇到的问题是,需要从表单中删除以下标记,否则它将被发送,而这不是我想要的。

The problem that I have is, the following tag needs to be removed from the form, otherwise it will get sent and that's not what I want.

不,它不会。您的 $('。de')。remove(); 将从页面中删除任何匹配的元素,如果表单随后提交,则不会随表单一起提交。

No, it won't. Your $('.de').remove(); will remove any matching elements from the page, and they will not be submitted with the form if the form is then submitted.

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

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