예제:
<script>
//주문번호 scr
function copyToClipboard() {
const orderRef = document.getElementById('orderRef').textContent;
navigator.clipboard.writeText(orderRef).then(function() {
alert('주문번호가 복사되었습니다.');
}, function(err) {
alert('복사 실패: ' + err);
});
}
</script>
<p><mark class="mark" id="orderRef"><%= orderRef %></mark>
<small>* 발급현황 조회 시 사용되는 번호입니다.</small>
<button class="subbtnsmall" type="button" onclick="copyToClipboard()">복사</button></p>
결과: