当前位置:网站首页>ES6 从入门到精通 # 03:模板字符串
ES6 从入门到精通 # 03:模板字符串
2022-07-21 13:10:00 【凯小默】
说明
ES6 从入门到精通系列(全23讲)学习笔记。
模板字符串
使用 tab 键上面的反引号,插入变量时使用 ${变量名}
。
例子:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="box1">
</div>
<div class="box2">
</div>
<script> const name1 = "kaimo666"; const id1 = "k6"; const boxDom1 = document.querySelector(".box1"); boxDom1.innerHTML = "<ul><li id="+ id1 +"><p>"+ name1 +"</p></li></ul>"; const name2 = "kaimo777"; const id2 = "k7"; const boxDom2 = document.querySelector(".box2"); boxDom2.innerHTML = `<ul><li id=${
id2}><p>${
name2}</p></li></ul>`; </script>
</body>
</html>
边栏推荐
- 二叉树刷题(完结篇)
- You are only one SQL statement away from the tdengine Developer Conference!
- If there is out in PG function, returns setof record as is ignored$$
- 【板栗糖GIS】记录两个傻到不能再傻的记录——台式电脑无信号或者不亮屏
- 微服务技术发展
- 【读书会第13期】+第二章 视频文件的封装格式
- 优思学院|从《孙子兵法》中学习六西格玛管理
- Command line use of eslint
- Summary of recommendation system papers
- FTP服务与配置
猜你喜欢
【板栗糖GIS】腾讯会议的个人用户如何改名
如何使用多类型数据预训练多模态模型?
LeetCode·每日一题·814.二叉树剪枝·递归
[chestnut sugar GIS] ArcMap - how to quickly generate the four directions information
如何清理C盘
Navicat 导入sql脚本文件
Exclusive interview with sportlive Li Ying: how to use Web3 to promote sports IP to expand the "new business territory"
Human moon day | exclusive interview with Zou Haiyang: China's aerospace dream is a story of trust and live up to
What if MySQL deletion fails
Let Matplotlib and Seaborn data map move ~
随机推荐
Common operations of windows10 system
[chestnut sugar GIS] WPS -- how to fill the space in the content of the previous line
mysql删除失败怎么办
LeetCode·
mysql 逻辑架构
[chestnut sugar GIS] record two stupid records - desktop computer has no signal or does not light up
如何绘制PCB外形加工图
Microservice technology development
【微信小程序】WXSS和全局、页面配置入门砖
strcmp()&nbsp;- Compare strings
Symbol的使用,es6获取key值的新方法
Navicat import SQL script file
MySQL data type
Xuantai pharmaceutical passed the registration: it plans to raise 600million yuan, and Lianhe investment is the major shareholder
Detailed explanation of cesium events (mouse events, camera events, keyboard events, scene trigger events)
【板栗糖GIS】bat—怎么删除子文件夹下的同后缀名的数据
What if MySQL deletion fails
Introduction to excellent verilog/fpga open source project (XXIX) - open source website
C language student achievement management system
Pl/sql record