I would like to remove a tag with the class of '.de'.
$('.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.
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.
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.
You cannot delete a tag from source code with j Query if you want to do that try to add the tag with jQuery.(Dynamically created tags or elements only can be removed dynamically using jQuery.)