第 14 课 5 / 18 | 编码:L14-09
核心知识

getElementById

按唯一 id 查询一个元素,找不到时返回 null。

  • 参数不写 #
  • id 在页面中应唯一
  • 适合明确的单一目标
const status = document.getElementById('status');