日常疑问

21 阅读1分钟

获取dom元素的时候,什么时候使用#? 用  #:仅在  querySelector / querySelectorAll  中表示id选择器时使用。

不用  # :在  getElementById  或原生DOM方法中直接传入id字符串。