Get the object object first, and then.
object.parentNode.removeChild(object);
The deletion steps are as follows:
ar arr = [ 1, 2, 3, 4, 5 ];
//Original array
alert("Original array:" arr); // 1,2,3,4,5
//Delete and return the first element
Note: Repeat the above steps
1. JavaScript
Abbreviated as js, a literal scripting language, a dynamically typed, weakly typed, prototype-based language with built-in support for types;
Its interpreter is called JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML web pages to add dynamic functions to HTML web pages;
In 1995, it was first designed and implemented on the Netscape Navigator browser by Brendan Eich of Netscape.
2. js expression:
An expression refers to a formula that connects constants, variables, functions, operators and parentheses;
According to different operation results, expressions can be divided into arithmetic expressions, character expressions, and logical expressions.
Use the removeChild() method to specify a specified child node of the element to complete javascript deletion of an html element.
Javascript steps to delete an html element:
Know
I did this!
Test passed! ! Brothers, you can take a look! !
The above is the detailed content of How to dynamically delete object objects in Javascript. For more information, please follow other related articles on the PHP Chinese website!