Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
106
rated 0 times [  112] [ 6]  / answers: 1 / hits: 17569  / 12 Years ago, thu, may 3, 2012, 12:00:00

I am using this JavaScript code to remove a couple elements from the page, but it's not working. When I inspect the code with Opera Dragonfly it says something like:



Uncaught exception: Error: WRONG_ARGUMENTS_ERR


and points to the file and function name.



The weird thing is that I use the exact same code in another function on the same page and it works without problem. The code is very small and simple:



var docBody = document.getElementById(body);
if(document.getElementById(marginDiv)){
docBody.removeChild(marginDiv);
}


Both body and marginDiv exist on the page. My goal is to make the thumbnails disappear when one clicks the background.


More From » removechild

 Answers
41

Try



docBody.removeChild(document.getElementById(marginDiv));

[#85817] Wednesday, May 2, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aman

Total Points: 341
Total Questions: 92
Total Answers: 92

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
;