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
-1
votes
3 answers

Javascript DOM Manipulation error with removeChild and addEventListener

I'm basically building a pretty simple list. Write something in the input field at the top, click the button and it appears in a ul underneath. I'm getting two errors in my console, I'm not really sure what I've done wrong. Firstly, on line 12, this…
Greggo
  • 97
  • 1
  • 2
  • 11
-1
votes
2 answers

How to delete all data in div by id after using file_get_contents php php [Using PHP]?

How to delete all data in div by id after using file_get_contents php [Using PHP]? I want to delete all data inside div id="one" This is coding on https://www.example.com
-1
votes
3 answers

How to delete specified children?

dfg

yoyo

yoyo2

  • somo
For example I want to delete only h1 from body. The other children should stay
igodie
  • 497
  • 1
  • 4
  • 16
-1
votes
1 answer

AS3 removeChild and collisions : issue

I'm working in a little shooting game with Flash and AS3. I'm still beginning for using Class documents, but I managed to understand thanks to tutorials. So here's how it works : I used the HitTestObject when the Enemy MovieClip hits a bullet, shot…
-1
votes
2 answers

JavaScript How to remove a child

Using javascript, I am adding two buttons, one will add a picture and the other will delete a picture. I'm just practicing for an exam... The button and function to add the picture work beautifully, I am struggling with the function to delete the…
Rp Ck
  • 59
  • 1
  • 4
-1
votes
2 answers

Remove an element that doesn't have a parent

This is different from Remove dom element without knowing its parent?, because their element does have a parentNode. I know how to remove an element through its parentNode, but if I create a new element, it doesn't have a parentNode at all. So, a)…
GolezTrol
  • 114,394
  • 18
  • 182
  • 210
-1
votes
2 answers

JS, DOM. Delete several elements from DOM using user intput value

Example on Codepen below. Can anybody explain as simple as posible how to delete a number of elements from DOM based on a user input value (just an integer). I have a path(SVG curve). User specifies a number of steps(dots) to reach the end point of…
geliokant
  • 25
  • 6
-1
votes
1 answer

Removing Elements From Arrays in SpriteKit/Swift

When you remove a SpriteNode from Parent in SpriteKit, does it automatically remove it from any arrays that it is in? Also, when you remove an element from an array, does every other element shift or is there a gap where the element used to be?
Tommy
  • 140
  • 8
-1
votes
6 answers

jQuery remove selector content from a string

My javascript html string is:
  • 1
  • 2
  • 3
this should be removed
Makla
  • 9,899
  • 16
  • 72
  • 142
-1
votes
1 answer

remove first or specific child node xpath

this code get table. I want to remove first and second tr tag in the table. $data = array(); $table_rows = $xpath->query('//table[@class="adminlist"]/tr'); if($table_rows->length <= 0) { // exit if not found echo 'no table rows…
amir rasabeh
  • 427
  • 8
  • 16
-1
votes
1 answer

JQuery Get element without one of it's children?

is it possible to do this in JQuery:

Test test

HELOOOO
If I have the above code stored in variable (eg: var content), is there any function to call that returns me the…
Rus Paul
  • 1,348
  • 2
  • 14
  • 23
-1
votes
1 answer

How Can I Remove A Single Parent From Firebase?

In Firebase, there is a tree that holds data using parents, elements, and childs. Like so: m3r945ba1lh -JTHUY9SMruiPaKW6-SW calendar: "2014-08-14" name: "apple" -JTHWE66v3E7NTuUidfM calendar: "" name: "hello" text: "10101" …
-1
votes
1 answer

how to remove the child node in js

i have one parent node name orgdiv and one child node name newdiv. I am trying to remove the child node but its not working here is the code. function ajxsrch(str) { if (str.length != 0) { if (count == 0) { var newdiv =…
Ayyan Alvi
  • 34
  • 1
  • 10
-1
votes
2 answers

jQuery: use .remove() instead of Regex inside object

I have a TD that always contains a div and some text outside the div. The div has four nested divs that always follow the below structure. The only thing I am interested in is the text in this TD that appears outside the main div, everything else…
user2571510
  • 11,167
  • 39
  • 92
  • 138
-1
votes
1 answer

Remove elements slideshow

I try to remove my links one by one from div id="wrapper". But it doesn't work: window.onload = function () { setInterval(function () { var wrapper = document.getElementById("wrapper"); var my_links = wrapper.getElementsByTagName("a"); …
1 2 3
44
45