Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
46
rated 0 times [  51] [ 5]  / answers: 1 / hits: 21103  / 11 Years ago, wed, october 9, 2013, 12:00:00

this my html



<div>
<div id=div2 ondrop=drop(event) ondragover=allowDrop(event)></div>
</div>


this my script



var list=document.getElementById(div2);
list.removeChild(div2));


when i click the buttton i need to remove the child div(div2) how to do that. using this code i am facing problem please tell. help me . we have any other solution for this problem


More From » html

 Answers
8

you have double quotes and double braces at the end. And I'm not sure what you're trying to do. If you'd like to remove element with the id div2, use:



var list=document.getElementById(div2);
list.parentNode.removeChild(list);

[#75125] Tuesday, October 8, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tierney

Total Points: 45
Total Questions: 101
Total Answers: 94

Location: Sudan
Member since Thu, May 7, 2020
4 Years ago
;