jquery实现密码不能复制粘贴功能

本文共有520个字,关键词:

问题:在表单中不希望密码是复制粘贴上去的
解决:使用jquery的copy cut paste事件
方法:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<title>jquery实现密码不能复制粘贴功能</title>
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(function(){
$("input:text").bind("copy cut paste",function(e){
setTimeout(aa,1000);
});
function aa(){
console.log($("#a").val());
};
})
</script>
</head>
<body>
<p>输入密码: <input id='a' type="text"/></p>
<p>再次输入密码: <input id="b" type="text"/></p>
</body>
</html>

版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。
添加新评论
暂无评论