Simple example of adding and removing HTML nodes

Simple example of adding and removing HTML nodes
<br />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>

<<:  Share CSS writing standards and order [recommended for everyone to use]

>>:  Example of how to configure nginx to implement SSL

Recommend

What does mysql database do

MySQL is a relational database management system ...

JavaScript implements countdown on front-end web page

Use native JavaScript to simply implement the cou...

Nginx Layer 4 Load Balancing Configuration Guide

1. Introduction to Layer 4 Load Balancing What is...

Let’s talk in detail about how JavaScript affects DOM tree construction

Table of contents Document Object Model (DOM) DOM...

JavaScript BOM Explained

Table of contents 1. BOM Introduction 1. JavaScri...

Detailed tutorial on installing PHP and Nginx on Centos7

As the application of centos on the server side b...

Basic usage of exists, in and any in MySQL

【1】exists Use a loop to query the external table ...

A brief discussion on the performance issues of MySQL paging limit

MySQL paging queries are usually implemented thro...

Start nginxssl configuration based on docker

Prerequisites A cloud server (centOS of Alibaba C...

MySQL master-slave principle and configuration details

MySQL master-slave configuration and principle, f...

Tutorial on installing JDK Tomcat MySQL on Linux (remote access using Mac)

One environment Alibaba Cloud Server: CentOS 7.4 ...

Vue project implements left swipe delete function (complete code)

Achieve results The code is as follows html <t...

Hadoop 2.x vs 3.x 22-point comparison, Hadoop 3.x improvements over 2.x

Question Guide 1. How does Hadoop 3.x tolerate fa...