当前位置:网站首页>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
边栏推荐
- Mixed density network (MDN) for multiple regression explanation and code example
- 元宇宙系统的概念解析
- Joseph Ring - formula method (recursive formula)
- How to reload the win10 app store?
- Sword finger offer 03 Duplicate number in array
- Finally, we can figure out whether the binding event in the tag is bracketed or not
- The situation and suggestions of a software engineering associate graduate who failed in the postgraduate entrance examination
- 剑指 Offer 05. 替换空格
- Client development (electron) system level API usage
- Reflection - learning notes
猜你喜欢

Golang uses Mongo driver operation - increase (Advanced)

中国高校首次!全球唯一!同济学子斩获国际大奖

How to reload the win10 app store?

04. binary tree

Popular cross domain

Optimization of lazyagg query rewriting in parsing data warehouse
What is session? How is it different from cookies?

基于神经标签搜索,中科院&微软亚研零样本多语言抽取式摘要入选ACL 2022

剑指 Offer 10- I. 斐波那契数列
How to convert a recorded DOM to a video file
随机推荐
Sword finger offer 10- I. Fibonacci sequence
MT60B1G16HC-48B:A美光内存颗粒FBGA代码D8BNK[通俗易懂]
What is the safest app for stock account opening? Tell me what you know
Popular cross domain
剑指 Offer 09. 用两个栈实现队列
通俗讲跨域
教务系统开发(PHP+MySQL)
不要小看了积分商城,它的作用可以很大!
Open the box to experience rust, come on!!!
Classic deadlock scenario of multithreading and its solution (philosopher dining problem)
TensorFlow加载cifar10数据集
Programmer vs hacker thinking | daily anecdotes
Several relationships of UML
Practice of geospatial data in Nepal graph
How to debug grpc by postman
Introduction to database transactions
Sword finger offer 09 Implementing queues with two stacks
加载本地cifar10 数据集
Prototype mode
Client development (electron) system level API usage 2