Simple example of adding and removing HTML nodes

Simple example of adding and removing HTML nodes

Simple example of adding and removing HTML nodes Simple example of adding and removing HTML nodes
<input type="button" onclick="appendnode()" value="Add node">
<input type="button" onclick="removenode()" value="Delete node">
<div id="result"></div>
<script>
i=0
function appendnode() {
o=document.createElement("DIV");
o.innerHTML="test" i
document.getElementById('result').appendChild(o);
i
}
function removenode(){
var x = document.getElementById('result');
x.removeChild(x.lastChild) //Delete from the last node
}
</script>

<<:  Pitfalls based on MySQL default sorting rules

>>:  Example of how to set up a multi-column equal height layout with CSS

Recommend

Practice of realizing Echarts chart width and height adaptation in Vue

Table of contents 1. Install and import 2. Define...

Vue parent-child component mutual value transfer and call

Table of contents 1. Parent passes value to child...

JavaScript to achieve drop-down menu effect

Use Javascript to implement a drop-down menu for ...

About MariaDB database in Linux

Table of contents About MariaDB database in Linux...

Several ways to submit HTML forms_PowerNode Java Academy

Method 1: Submit via the submit button <!DOCTY...

MySQL Error 1290 (HY000) Solution

I struggled with a problem for a long time and re...

MySQL 8.0.12 Quick Installation Tutorial

The installation of MySQL 8.0.12 took two days an...

Solution for installing opencv 3.2.0 in Ubuntu 18.04

Download opencv.zip Install the dependencies ahea...

MySQL learning tutorial clustered index

Clustering is actually relative to the InnoDB dat...

Problems with using wangeditor rich text editing in Vue

wangEditor is a web rich text editor developed ba...

A complete guide to some uncommon but useful CSS attribute operations

1. Custom text selection ::selection { background...

react-beautiful-dnd implements component drag and drop function

Table of contents 1. Installation 2.APi 3. react-...

Multiple solutions for cross-domain reasons in web development

Table of contents Cross-domain reasons JSONP Ngin...

mysql wildcard (sql advanced filtering)

Table of contents First, let's briefly introd...