k

[복사하기] 버튼 자료~

· 13년 전 · 2357

<script>
 function copyClip(clip) {
    copyOption = document.body.createTextRange();
    copyOption.moveToElementText(clip)
    copyOption.execCommand('copy');
    alert('복사되었습니다.');
 }
 </script>
 

<button style="cursor:pointer" onclick=copyClip(clip1)>1번복사물</button>
 <div id=clip1 style="display:none">대한민국</div>
 <button style="cursor:pointer" onclick=copyClip(clip2)>2번복사물</button>
 <div id=clip2 style="display:none">축구</div>
 <button style="cursor:pointer" onclick=copyClip(clip3)>3번복사물</button>
 <div id=clip3 style="display:none">국가대표</div>
 <button style="cursor:pointer" onclick=copyClip(clip4)>4번복사물</button>
 <div id=clip4 style="display:none">감독</div>
 <button style="cursor:pointer" onclick=copyClip(clip5)>5번복사물</button>
 <div id=clip5 style="display:none">조광래</div>

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

개발자팁

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
웹서버 13년 전 조회 1.9만
Mobile 13년 전 조회 4,385
PHP 13년 전 조회 5,621
PHP 13년 전 조회 5,032
PHP 13년 전 조회 2,369
jQuery 13년 전 조회 3,522
jQuery 13년 전 조회 2,822
JavaScript 13년 전 조회 3,290
PHP 13년 전 조회 2,306
PHP 13년 전 조회 3,675
jQuery 13년 전 조회 9,972
웹서버 13년 전 조회 4,869
PHP 13년 전 조회 4,894
JavaScript 13년 전 조회 1.7만
JavaScript 13년 전 조회 2,358
PHP 13년 전 조회 8,903
jQuery 13년 전 조회 2,462
OS 13년 전 조회 5,640
OS 13년 전 조회 6,890
웹서버 13년 전 조회 7,534
PHP 13년 전 조회 4,350
OS 13년 전 조회 4,194
OS 13년 전 조회 8,132
jQuery 13년 전 조회 3,293
jQuery 13년 전 조회 7,194
jQuery 13년 전 조회 9,089
PHP 13년 전 조회 2,024
PHP 13년 전 조회 2,113
OS 13년 전 조회 5,748
OS 13년 전 조회 3,631
🐛 버그신고