Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
can someone please tell me how to remove div element using javascript. I'm on a Shopify theme edit.
I need to this to be or
First, get the div that you need to remove.
and then remove the div from its parent.
var element = document.getElementById("childDiv"); element.parentNode.removeChild(element);
Add a comment
Here is some example hope this will help you!
var btn = document.getElementById('btn'); btn.onclick = function () { document.getElementById('did').remove(); this.remove(); };
<div id='did'> <p id='pid'>Hello World</p> <input id='btn' type="submit" value='REMOVE THAT!!!'/> </div>
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.