首页 > 解决方案 > 使用 document.querySelector('#id') 和 document.getElementById('id') 的区别

问题描述

我是 javascript 的初学者,我看到很多人使用document.querySelector('#id') 和一些人使用document.getElementById('id')id 来获取 html 元素。请回答天气这些是相同的,否则我们必须以不同的方式使用它们。

标签: javascripthtml

解决方案


推荐阅读