강의

멘토링

커뮤니티

Inflearn Community Q&A

sanghyeok5555's profile image
sanghyeok5555

asked

JavaScript+jQuery from Basics to Practice: Intermediate Part.1

Practice - Node Creation, Addition, Deletion, Movement (4)

실습 - 노드 생성, 추가, 삭제, 이동 (4) - ex09 中

Written on

·

270

0

html() 메서드와 동일하게

append() 메서드도 추가할 데이터를 모두 만든 후

한 번에 추가가 가능했습니다.

$("#addHTML").on("click", function() {
                for (let i = 0; i < 10; i++) {
                    data += "<li>menu" + i + "</li>";
                }

                // html() 메서드를 1회만 호출해서 노드를 추가할 수 있다.
                $menu.html(data);
                // $menu.append(data) 도 동일한 결과가 출력된다.

            });

메서드 내부에서는 작동하는 원리가 다를 수 있겠습니다.

jqueryjavascript

Answer

This question is waiting for answers
Be the first to answer!
sanghyeok5555's profile image
sanghyeok5555

asked

Ask a question