Summary of three ways to create new elements

Summary of three ways to create new elements

First: via text/HTML

var txt1="<h1>Text.</h1>";

Second: Through jQuery

var txt2=$("<h2></h2>").text("Text.");

The third method: through JavaScript/DOM

var txt3 = document.createElement("h3");
txt3.innerHTML="Text.";

The above summary of three methods of creating new elements is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

Original URL: http://www.cnblogs.com/SoYang/p/5677589.html

<<:  Solution to Navicat Premier remote connection to MySQL error 10038

>>:  ReactHooks batch update state and get route parameters example analysis

Recommend

5 ways to quickly remove the blank space of Inline-Block in HTML

The inline-block property value becomes very usef...

About the overlap of margin value and vertical margin in CSS

Margin of parallel boxes (overlap of double margi...

Apache Spark 2.0 jobs take a long time to finish when they are finished

Phenomenon When using Apache Spark 2.x, you may e...

Analysis of the problem of deploying vue project and configuring proxy in Nginx

1. Install and start nginx # Install nginx sudo a...

How to install redis5.0.3 in docker

1. Pull the official 5.0.3 image [root@localhost ...

Detailed introduction to CSS font, text, and list properties

1. Font properties color, specifies the color of ...

mysql update case update field value is not fixed operation

When processing batch updates of certain data, if...

Springboot+VUE to realize login and registration

This article example shares the specific code of ...

How to use ElementUI pagination component Pagination in Vue

The use of ElementUI paging component Pagination ...

JavaScript common statements loop, judgment, string to number

Table of contents 1. switch 2. While Loop 3. Do/W...

Solve the MySQL 5.7.9 version sql_mode=only_full_group_by problem

MySQL 5.7.9 version sql_mode=only_full_group_by i...

HTTP and HTTP Collaboration Web Server Access Flow Diagram

A web server can build multiple web sites with in...

Understand all aspects of HTTP Headers with pictures and text

What are HTTP Headers HTTP is an abbreviation of ...