This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 60046
    
  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);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Removing an element
 
Similar Threads
tooltiptext question
Shuffle Game that i created is not working as i expect.
window.onload in self invoking function
Can't Get ScrollBar to Show
Return item in array