Closed akelmj closed 4 years ago
I suppose you are an user of jquery. see this example, or just use method remove.
thank you for your fast response :+1:
what if i want to delete an element without parent:
example:
`
Sorry, I don't get your point. and, what's the example?
the remove() method remove only child element.
example that wok:
`
`
`let custom_element = selector.querySelector("custom");
custom_element.remove();`
example that NOT work (the custom tag outside the HTML):
`
Yes, you explained well. This is not a simple issue, the reason is the element has not get a parent. Actually, it do has a root node called 'Root', but the element has no parent for most users, see code:
response.childNodes.forEach((node) => {
if (node instanceof HTMLElement) {
node.parentNode = null;
}
});
I don't know if we can change some code here, and just make remove
seems right.
Maybe that will also make sense.
try v2.0.0, good luck!
Hi, I have this code:
let div = selector.querySelector("#divid");
i want to remove the div like:
div.remove();
is there any way to do that?