javascript - disable paste (control V) in IE for an input text box - Stack Overflow

Is there a way to disable the paste (control V) into a text box using javascriptjquery for IE? I do no

Is there a way to disable the paste (control V) into a text box using javascript/jquery for IE?

I do not have access to the markup unfortunately or I would use onPaste="return false". Can it be attached with Jquery?

If it cannot be disabled at least is there a way to detect it so that when the paste event occurs just remove the text from the input text box.

<input type="text" maxlength="" size="25" value="Enter letters here" name="TEXTBOX___97___470GCPC___31" autoplete="off">

Is there a way to disable the paste (control V) into a text box using javascript/jquery for IE?

I do not have access to the markup unfortunately or I would use onPaste="return false". Can it be attached with Jquery?

If it cannot be disabled at least is there a way to detect it so that when the paste event occurs just remove the text from the input text box.

<input type="text" maxlength="" size="25" value="Enter letters here" name="TEXTBOX___97___470GCPC___31" autoplete="off">
Share Improve this question asked Sep 11, 2010 at 19:09 user357034user357034 11k19 gold badges59 silver badges74 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Try

$('input[name="TEXTBOX___97___470GCPC___31"]').bind('paste', function(){return false;})

There is no need to use jQuery though, as you could just set the onpaste handler.

var input = document.getElementsByName('TEXTBOX___97___470GCPC___31')[0];
if (input)
   input.onpaste = function(){return false;};

Note that this event may not fire on some browsers (e.g. Opera). Also, see this question: Disable Copy/Paste into HTML form using Javascript on why you should not disable pasting.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744906152a4600269.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信