input禁止复制粘贴插入文字

<input type="text"></input>
<script>
  const input = document.querySelector('input');

  input.addEventListener("paste", function(e){
    e.preventDefault()
  })

</script>

 

posted @ 2021-08-05 10:10  ThisCall  阅读(179)  评论(0编辑  收藏  举报