Skip to content

Commit 657d8eb

Browse files
ntachevadimodi
andauthored
Update knowledge-base/inputs-disable-copy-paste.md
Co-authored-by: Dimo Dimov <[email protected]>
1 parent fceb3a3 commit 657d8eb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

knowledge-base/inputs-disable-copy-paste.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ To disable the copy and paste functionality in a TextBox and other Telerik Blazo
5858
@* Move JavaScript code to a separate JS file in production *@
5959
<script suppress-error="BL9992">
6060
function preventCutCopyPaste() {
61-
var tb = document.querySelector(".no-copy-paste input");
61+
var input = document.querySelector(".no-copy-paste input");
6262
63-
tb.oncopy = e => e.preventDefault();
64-
tb.onpaste = e => e.preventDefault();
63+
if (input) {
64+
input.oncopy = e => e.preventDefault();
65+
input.onpaste = e => e.preventDefault();
66+
}
6567
}
6668
</script>
6769

0 commit comments

Comments
 (0)