답변 3개
채택된 답변
+20 포인트
3년 전
https://developer.mozilla.org/en-US/docs/Web/API/Element/copy_event https://developer.mozilla.org/en-US/docs/Web/API/Element/cut_event https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drop_event
</p>
<p><input class="nocp" type="text" />
<textarea class="nocp"></textarea></p>
<p><script>
function fn_nocp(evt) {
evt.preventDefault();
}
var nocp = document.querySelectorAll('.nocp');
for (var i = 0, i_len = nocp.length; i < i_len; i++) {
nocp[i].addEventListener('copy', fn_nocp, false);
nocp[i].addEventListener('cut', fn_nocp, false);
nocp[i].addEventListener('paste', fn_nocp, false);
nocp[i].addEventListener('drop', fn_nocp, false);
}
</script></p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
�
세크티
3년 전
댓글을 작성하려면 로그인이 필요합니다.
3년 전
콘트롤 키랑 마우스 우클만 막으면됩니다.
</p>
<pre>
<input type="text" class="test">
<script>
$(".test").keydown(function(e) {
if (e.ctrlKey) {
alert('복사 및 붙여넣기 금지');
return false
}
});
$(".test").mousedown(function(e) {
if (e.which == 3) {
alert('복사 및 붙여넣기 금지');
return false
}
});
</script></pre>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
배르만
3년 전
Shift + Insert / text drag & drop 도 있습니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
https://stackoverflow.com/questions/2625210/long-press-in-javascript
위 사이트보고 참조하시면 될거같네요