몸 위에 버튼 복제 부모 사업부를하는 방법

ZON 소알 :

나는 클릭하면 몸에있는 버튼의 부모와 APPEND의 부모를 복제하는 버튼을하려고 해요 :

<div class="userposts">
    <p class="postusername">Posted by $postuser</p>
    <script type="text/javascript">
        function click() {
            var div = this.parentElement.parentElement;
            var clone = div.cloneNode(true);

            document.body.appendChild(clone);

        }
    </script>
    <h2 class="posttitle"><button onclick="click()" type="button">$title<button></a></h2>

이것은 내가 지금까지 가지고 있지만 그것은하지 않습니다 APPEND 아무것도 없으며이 오류 메시지를 남겨 않는 것입니다.

존 마르첼로 :

나는, 클릭 () 함수는 자바 스크립트에서 예약 된 이름이라고 생각 이름을 변경하려고합니다.

추천

출처http://43.154.161.224:23101/article/api/json?id=32206&siteId=1