document.querySelector always returns null

前端 未结 4 1733
野的像风
野的像风 2021-01-20 01:38

I\'ve looked at the other answers but still don\'t understand.

For some reason this line of code always returns null.

var els = document.querySelecto         


        
4条回答
  •  滥情空心
    2021-01-20 01:58

    I doubt your JS gets loaded before the markup and css. In that case, you could try using

    The contents are loaded first and your java script should work fine after that.

提交回复
热议问题