<div id="board">
<div id="sss" class="card"><img src="img/sss" alt="sss"></div>
<div id="ssa" class="card"><img src="img/sss" alt="sss"></div>
<div id="ssb" class="card"><img src="img/sss" alt="sss"></div>
</div>
如何使用"sss"
获取ID "ssa"
,"ssb"
,"board"
的列表?
document.querySelectorAll('#board > div').forEach(dv=>console.log(dv.id))
<div id="board">
<div id="sss" class="card"><img src="img/sss" alt="sss"></div>
<div id="ssa" class="card"><img src="img/sss" alt="sss"></div>
<div id="ssb" class="card"><img src="img/sss" alt="sss"></div>
</div>