k

[복사하기] 버튼 자료~

· 13년 전 · 2365

<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,397
PHP 13년 전 조회 5,632
PHP 13년 전 조회 5,047
PHP 13년 전 조회 2,377
jQuery 13년 전 조회 3,537
jQuery 13년 전 조회 2,834
JavaScript 13년 전 조회 3,302
PHP 13년 전 조회 2,319
PHP 13년 전 조회 3,687
jQuery 13년 전 조회 9,987
웹서버 13년 전 조회 4,875
PHP 13년 전 조회 4,906
JavaScript 13년 전 조회 1.7만
JavaScript 13년 전 조회 2,366
PHP 13년 전 조회 8,912
jQuery 13년 전 조회 2,475
OS 13년 전 조회 5,648
OS 13년 전 조회 6,900
웹서버 13년 전 조회 7,545
PHP 13년 전 조회 4,363
OS 13년 전 조회 4,205
OS 13년 전 조회 8,144
jQuery 13년 전 조회 3,309
jQuery 13년 전 조회 7,206
jQuery 13년 전 조회 9,096
PHP 13년 전 조회 2,035
PHP 13년 전 조회 2,121
OS 13년 전 조회 5,758
OS 13년 전 조회 3,633
🐛 버그신고