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

Blog    

Recommend

How to use Nginx to solve front-end cross-domain problems

Preface When developing static pages, such as Vue...

How to add links to FLASH in HTML and make it compatible with all major browsers

Look at the code first Copy code The code is as fo...

About the pitfall record of Vue3 transition animation

Table of contents background Problem location Fur...

iframe src assignment problem (server side)

I encountered this problem today. I reassigned the...

Detailed explanation of the relationship between Linux and GNU systems

Table of contents What is the Linux system that w...

How to manage large file uploads and breakpoint resume based on js

Table of contents Preface Front-end structure Bac...

Node.js file copying, folder creation and other related operations

NodeJS copies the files: Generally, the copy oper...

MySQL sorting using index scan

Table of contents Install sakila Index Scan Sort ...

Detailed steps to configure my.ini for mysql5.7 and above

There is no data directory, my-default.ini and my...

Detailed process of using nginx to build a webdav file server in Ubuntu

Install nginx Note that you must install nginx-fu...

Detailed explanation of Svn one-click installation shell script under linxu

#!/bin/bash #Download SVN yum -y install subversi...