답변 2개
채택된 답변
+20 포인트
답변에 대한 댓글 4개
t
tnhands
5년 전
복사되었습니다 라는 알람은 뜨는데 진짜 복사는 안되는데요?
�
폴라베어
5년 전
<?php $re_addr1 = $row['re_addr1'];?> 을 대입해주시거나 input value를 변경하시거나 하시면 됩니다.
t
tnhands
5년 전
<?php echo $row[re_addr1];?>
<button onclick="copy_to_clipboard()">주소복사</button>
<br/>
<input type="text" id="myInput" value="<?php echo $row[re_addr1];?>">
<script>
function copy_to_clipboard() {
$("#myInput").select();
document.execCommand("copy");
alert('복사되었습니다.');
}
</script>
이렇게 했는데되도 안되네요 ㅋㅋ 감사합니다
<button onclick="copy_to_clipboard()">주소복사</button>
<br/>
<input type="text" id="myInput" value="<?php echo $row[re_addr1];?>">
<script>
function copy_to_clipboard() {
$("#myInput").select();
document.execCommand("copy");
alert('복사되었습니다.');
}
</script>
이렇게 했는데되도 안되네요 ㅋㅋ 감사합니다
�
폴라베어
5년 전
JQuery 먼저 로드되야지 정상 작동합니다 의존성 없게 할려면 아래처럼하시면 됩니다.
<script>
function copy_to_clipboard() {
document.getElementById("myInput").select();
document.execCommand("copy");
alert('복사되었습니다.');
}
</script>
<script>
function copy_to_clipboard() {
document.getElementById("myInput").select();
document.execCommand("copy");
alert('복사되었습니다.');
}
</script>
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 2개
t
tnhands
5년 전
와 어렵군요 ㅋㅋ 예 해보겠습니다 감사합니다.
�
우성짱
5년 전
글이 많아보이는데 실제로는 몇줄 안됩니다 ㅎㅎ
홧팅!
홧팅!
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인