window.onload = () => { const myInput = document.getElementById('myInput'); myInput.onpaste = e => e.preventDefault(); }