当前位置:网站首页>Native JS dynamically add elements
Native JS dynamically add elements
2022-06-25 15:51:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Native js Add elements dynamically </title>
<style>
.phone {
width: 200px;
height: 30px;
}
ul {
width: 200px;
border: 1px solid #eee;
text-align: right;
}
ul li{
list-style: none;
height: 50px;
line-height: 50px;
padding-right: 20px;
border-right: 2px solid #999;
}
ul li:hover {
color: #f00;
border-right: 2px solid #f00;
}
/* .circle1 {
width: 492px;
height: 499px;
border-radius: 50%;
background: #f00;
display: flex;
align-items: center;
justify-content: center;
}
.circle2 {
width: 260px;
height: 434px;
border-radius: 50%;
background: #fff;
} */
</style>
</head>
<body>
<div class="container">
<form action="" id="form">
</form>
<ul id="parentUI">
<li> Hello </li>
<li> About us </li>
<li> Help center </li>
</ul>
</div>
<script>
var formId = document.getElementById("form");
// Create elements input
var inputPhone = document.createElement("input");
// Set up input Properties of
inputPhone.setAttribute("class","phone");
inputPhone.type = "text";
inputPhone.value = " Please enter your mobile number ";
formId.appendChild(inputPhone);
// js Dynamic addition li
var ul = document.getElementById("parentUI");
var li = document.createElement("li");
li.setAttribute("class","list");
li.innerHTML = " Contact us ";
ul.appendChild(li);
</script>
</body>
</html>Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/152106.html Link to the original text :https://javaforall.cn
边栏推荐
- Day01: learning notes
- Super comprehensive custom deep copy function
- Differences and solutions of redis cache avalanche, cache penetration and cache breakdown
- Sword finger offer 10- I. Fibonacci sequence
- VectorDraw Developer Framework 10.1001 Crack
- MySQL modifier l'instruction de champ
- Differences between = = and = = = in JS (detailed explanation)
- Sword finger offer II 091 Paint the house
- Report on Hezhou air32f103cbt6 development board
- QC, QA, IPQC, JQE, DQA, SQE, DQC, MQC, IQC, FQC, OQC
猜你喜欢

Sword finger offer 05 Replace spaces

Asynchronous processing of error prone points

教务系统开发(PHP+MySQL)

Sword finger offer 03 Duplicate number in array

TFIDF与BM25
MySQL installation tutorial

04. binary tree

Could not connect to redis at 127.0.0.1:6379 in Windows

Popular cross domain

VectorDraw Developer Framework 10.1001 Crack
随机推荐
Error com mysql. cj. jdbc. exceptions. Communicationsexception: solutions to communications link failure
程序员 VS 黑客的思维 | 每日趣闻
Sword finger offer 04 Find in 2D array
Source code analysis of nine routing strategies for distributed task scheduling platform XXL job
SQL最常用的语句
Consumer and producer cases of inter thread synchronization (condition variable)
元宇宙系统的概念解析
Practice of geospatial data in Nepal graph
股票开户用什么app最安全?知道的给说一下吧
Brief introduction to class loading process
解析数仓lazyagg查询重写优化
golang reverse a slice
什么是NFT数字藏品?
揭秘GaussDB(for Redis):全面对比Codis
Golang uses Mongo driver operation - increase (Advanced)
The style of the mall can also change a lot. DIY can learn about it!
不要小看了积分商城,它的作用可以很大!
免费送书啦!火遍全网的AI给老照片上色,这里有一份详细教程!
Es data synchronization mode
How GC determines whether an object can be recycled