TIL_221202

KIXIAM·2022년 12월 2일
1

TIL

목록 보기
6/22

이번주의 마지막

오늘부터 프로젝트 시작..
열심히 달려보자

<div id="div-01">Here is div-01</div>
<div id="div-02">Here is div-02</div>
<script>
  <div id="div-01">Here is div-01</div>
    <div id="div-02">Here is div-02</div>
    <script>
      let el = document.getElementById("div-01").nextElementSibling;
      console.log("nextElementSibling:", el);
      el = document.getElementById("div-01").nextSibling;
      console.log("nextSibling:", el);
</script>


다음 element의 정보를 반환한다.
nextElementSibling returns the next sibling element (ignores text and comments)
nextSibling returns the next sibling node: An element node, a text node, or a comment node.
nextSibling은 해당 element 내의 text node 값을 반환한다.


상세한 값이 나온다. node.js 빨리 배우고싶다...

profile
Project Oriented Learning 🔥

0개의 댓글