k

[복사하기] 버튼 자료~

· 13년 전 · 2361

<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,389
PHP 13년 전 조회 5,625
PHP 13년 전 조회 5,037
PHP 13년 전 조회 2,372
jQuery 13년 전 조회 3,525
jQuery 13년 전 조회 2,826
JavaScript 13년 전 조회 3,294
PHP 13년 전 조회 2,309
PHP 13년 전 조회 3,679
jQuery 13년 전 조회 9,974
웹서버 13년 전 조회 4,872
PHP 13년 전 조회 4,898
JavaScript 13년 전 조회 1.7만
JavaScript 13년 전 조회 2,362
PHP 13년 전 조회 8,906
jQuery 13년 전 조회 2,467
OS 13년 전 조회 5,645
OS 13년 전 조회 6,894
웹서버 13년 전 조회 7,537
PHP 13년 전 조회 4,357
OS 13년 전 조회 4,199
OS 13년 전 조회 8,137
jQuery 13년 전 조회 3,300
jQuery 13년 전 조회 7,198
jQuery 13년 전 조회 9,093
PHP 13년 전 조회 2,029
PHP 13년 전 조회 2,117
OS 13년 전 조회 5,750
OS 13년 전 조회 3,632
🐛 버그신고