Get first
  • WITHOUT jquery
  • 后端 未结 7 1099
    爱一瞬间的悲伤
    爱一瞬间的悲伤 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 08:44

      Using the basic DOM operations:

      var ul = document.getElementById('id of ul');
      var child = ul.childNodes[0];
      

    提交回复
    热议问题