Questions tagged [removechild]

removes and returns a child node from the DOM

Description

Removes and returns a child node from the DOM.

The removed child node still exists in memory, but is no longer part of the DOM. It can still be re-used, via the oldChild object reference.

Syntax

var oldChild = element.removeChild(child);
element.removeChild(child);

where,

child is the child node to be removed from the DOM.

element is the parent node of child.

oldChild holds a reference to the removed child node. oldChild === child.

References

672 questions
4
votes
2 answers

How can I remove an element that is not in the DOM?

var paragraphElement = document.createElement('p'); paragraphElement is not in the DOM. How can I remove it? I know I can use removeChild if it's in the DOM. I don't tend to add paragraphElement to the DOM and then remove it. Any solution? Thank…
weilou
  • 4,419
  • 10
  • 43
  • 56
3
votes
2 answers

Remove widget in gtk.Table?

I'm using gtk.Table in my python application. How can I remove a widget such a gtk.VBox, gtk.HBox or a gtk.Button that I attached in the table? I want to remove the widget in exactly position. Is there anyway to unattach a child widget from table?…
depzaivai
  • 33
  • 1
  • 5
3
votes
3 answers

python libXML2 remove Item

I am using libxml2 under python. Unfortunatly the python version of this library is really badly documented and i founded just few example on the web from there i could understand some of the method. I managed the add a soon te a XML Node. Since…
Stefano
  • 3,981
  • 8
  • 36
  • 66
3
votes
3 answers

How do you remove and hide HTML elements in plain Javascript?

I have this HTML:
Verified
And this Javascript: var body =…
chromedude
  • 4,246
  • 16
  • 65
  • 96
3
votes
2 answers

Removing XML nodes to reduce the size of an XML log file to a given size

I'm having some difficulty removing nodes from an xml file. I've found lots of examples of others doing this in powershell through various means, the code below would seem to be identical to many of the other examples I've seen, but I'm not getting…
3
votes
4 answers

JavaScript removeChild help

I am writing a simple little piece of code to draw pixels wherever the mouse is in a box. I also want to have a clear button. Drawing works fine, but I can't seem to get the clear button to work. Here are the relevant parts of my .js file: function…
Nick
  • 2,821
  • 5
  • 30
  • 35
3
votes
2 answers

JavaScript: How to remove tags from node?

In a previous question someone put me on to "rangy" http://code.google.com/p/rangy/. It's interesting even if I don't fully understand it. I am not a JavaScript person. However, I have managed to do most things with it that I need with the exception…
Russell Parrott
  • 873
  • 7
  • 19
  • 38
3
votes
1 answer

Hibernate deleted object would be re-saved by cascade

I'm trying to delete a child entity in hibernate but get this exception: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations):…
User1v0
  • 63
  • 1
  • 10
3
votes
2 answers

python xml remove grandchildren or grandgrandchildren

I've been googling for removing grandchildren from an xml file. However, I've found no perfect solution. Here's my case: item 1 text subitem1 text
ZDunker
  • 437
  • 1
  • 6
  • 18
3
votes
3 answers

How could I delete a specific element that I have created in javascript?

I'm making something for my own use that will allow me to quickly and easily stack commands (for Minecraft command block creations). I have already created a button to create new textareas and a button to delete them. Presuming that there will be…
3
votes
3 answers

Javascript - How to Remove DOM elements using click events and classes?

I am having some difficulty using parentNode.removeChild(). I have a list of 'items' in an un-ordered list, each have there own delete button. I am trying bind a click event to each individual button that will delete it's respective parent 'item'.…
3
votes
4 answers
3
votes
1 answer

PHP DOMDocument removeChild() only removing only the first instance of targeted class

I need to remove all instances of a particular class (only assigned to divs) from an HTML document. Here's the snippet I'm using: $dom = new DOMDocument; $dom->loadHTML($meaning); foreach ($dom->getElementsByTagName('div') as $node) { …
TheLearner
  • 2,813
  • 5
  • 46
  • 94
3
votes
1 answer

Javascript: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

i am trying to recreate a some practices from one of the courses. Its about to remove a li-item from an UL and append it to another UL. When i write my code in the following way all works finde var removeMeandAppendMe = function() { var parentLi…
Steve
  • 77
  • 1
  • 6
3
votes
2 answers

JS: remove lastChild only works every second button click

I use this code to delete the last item of an
    list, but only on the second, fourth, sixth, ... every second click on the button the item gets removed, but every click the message appears. What can I do that the element gets deleted on every…
user3340372
1 2
3
44 45