wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Removing an element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Removing an element" Watch "Removing an element" New topic
Author

Removing an element

Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
Hi,
How I remove an element from an HTML Page in javascript

I tried the following but it failed :


No Java Script error is returned but nothing happens.
Appreciate any help and advice.


SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/
Life is the biggest school
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Is the button a child of the document?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
The button is an indirect child of the document. It is contained in table datacell inside table.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Bear was hinting at your problem without saying it. The element needs to be removed from the body or the parent element. You either need to do document.body.removeChild(btn) or btn.parentNode.removeChild(btn);
 
wood burning stoves
 
subject: Removing an element
 
Similar Threads
tooltiptext question
Can't Get ScrollBar to Show
Shuffle Game that i created is not working as i expect.
Return item in array
window.onload in self invoking function