1
How to remove an HTML tag using Javascript?
For example, with insertAfter(); and insertBefore(); I can insert some tags if I want. But if I want to delete from my code, some TAG? Not by display: None, I want to delete even.
I found remove() but it doesn’t work on all browsers.
Example
<div class="1">Div 1</div>
<div class="2">Div 2</div>
<div class="3">Div 3</div>
<div class="4">Div 4</div>
In case, if I wanted to delete div 3? How do I? Remove it from HTML, stay like this:
<div class="1">Div 1</div>
<div class="2">Div 2</div>
<div class="4">Div 4</div>
Sorry, seriously you chose the answer you use
children[...]
instead of one that uses a selector? It’s okay that you want to work using Children neither will be necessary the class or any other attribute, just work by order, but just want to make sure you really understand the answers. It’s not a criticism, I was just confused even by your decision.– Guilherme Nascimento