본문 바로가기
개발자공간/SCRIPT

jquery 요소 복사하기 , clone()

by 냉국이 2020. 12. 16.
728x90

 

 

$(선택요소).clone();

 

//예제

<div class='buttons1'>
  <button>Button</button>
  <button>Button</button>
  <button>Button</button>
</div>

<div class='buttons2'>

</div>


<script>
  var cloneElements = $('.buttons1').clone();
  cloneElements.appendTo('.buttons2');

</script>

 

 

300x250

댓글