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

Problems with join queries and subqueries in MySQL

Table of contents Basic syntax for multi-table jo...

URL Rewrite Module 2.1 URL Rewrite Module Rule Writing

Table of contents Prerequisites Setting up a test...

Detailed explanation of MySQL date string timestamp conversion

The conversion between time, string and timestamp...

Add crontab scheduled tasks to debian docker container

Now most of the Docker images are based on Debian...

Detailed explanation of Vue's live broadcast function

Recently, the company happened to be doing live b...

How to use Axios asynchronous request API in Vue

Table of contents Setting up a basic HTTP request...

Explanation of the problem of selecting MySQL storage time type

The datetime type is usually used to store time i...

HTML form tag tutorial (5): text field tag

<br />This tag is used to create a multi-lin...

Native js implements custom scroll bar component

This article example shares the specific code of ...

How to install Element UI and use vector graphics in vue3.0

Here we only focus on the installation and use of...

How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment

Enable WSL Make sure the system is Windows 10 200...

Detailed explanation of Vite's new experience

What is Vite? (It’s a new toy on the front end) V...

MySQL 8.0.19 Installation Tutorial

Download the installation package from the offici...