问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
<!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>
<style>
.main{
margin: 100px auto;
width: 300px;
height: 200px;
background-color: rgb(168, 168, 168);
overflow: hidden;
text-align: center;
}
.father{
display: inline-block;
margin: 90px auto;
}
.father>button,.father>i{
float: left;
margin-left: 15px;
width: 35px;
height: 25px;
background-color: rgb(36, 36, 36);
color: aliceblue;
font-style: normal;
}
.father .one{
margin-left: 0px;
}
</style>
</head>
<body>
<div class="main">
<div class="father">
<button class="one">+</button>
<i>0</i>
<button class="two">-</button>
</div>
</div>
<script>
var one = document.querySelector('.one');
var one_one = document.getElementsByClassName('.one');
var father = document.querySelector('.father');
var son = father.querySelectorAll('button');
console.log(son[0]);
console.log(one);
</script>
</body>
</html>
我的解答思路和尝试过的方法
我想要达到的结果