Get first
  • WITHOUT jquery
  • 后端 未结 7 1096
    爱一瞬间的悲伤
    爱一瞬间的悲伤 2020-12-19 08:13

    This may have been asked, but scrolling through about 40+ search results reveals only the jQuery solution. Let\'s say I want to get the first item in an unordered list and a

    相关标签:
    7条回答
    • 2020-12-19 09:05

      In some cases, this is enough:

      document.querySelector("ul > li:first-child");
      
      0 讨论(0)
    提交回复
    热议问题