html - 防止在 html5 应用程序中剪切复制粘贴

标签 html jquery jquery-events paste

我不想允许用户在文本框中剪切复制粘贴 我尝试过以下代码,但它甚至没有绑定(bind)到该元素:

$(document).ready(function(){
$("userName").on("cut copy paste",function(e){
e.preventDefault();
});
});

最佳答案

$(document).ready(function(){
  $('#userName').bind("cut copy paste",function(e) {
  e.preventDefault();
 });
});

关于html - 防止在 html5 应用程序中剪切复制粘贴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22090615/

相关文章:

jquery - 清除行中的值并模拟单击它

javascript - jQuery 事件 : prepend a callback handler to already existing ones

html - Css 在 vue 组件中使聊天框位于其他内容的前面

html - 如何使用 CSS <select> 使每个选项的宽度与其内容一样长

javascript - 单击单选按钮时必须输入文本框

javascript - jQuery 写得更有 Eloquent ——结合逻辑

javascript - 有没有类似websocket但不需要像node这样的框架的东西?

javascript - 按 "enter"键时的 IE7 不会阻止默认操作

javascript - 如何在 jquery 中附加具有特定数字的表行

javascript - Html 内容到 Pdf 转换