document.querySelectorAll('input, textarea').forEach((el) => { // Remove inline oncopy and onpaste handlers console.log(el) el.oncopy = null; el.onpaste = null; // Or remove attribute values if needed el.removeAttribute('oncopy'); el.removeAttribute('onpaste'); });