admin管理员组文章数量:1310513
It seems that the only way to add an onPaste
event to an input element is to use HTML:
<textarea id="text_area" onpaste="on_paste" />
rather than being able to attach the event handler using JavaScript:
document.getElementById('text_area').onPaste = function() { alert('I iz in ur textbox, pasting some text') };
The MSDN website says you can only add event handlers for onPaste
using jscript or HTML, but I want to do it in JavaScript. Is there any way to do this?
It seems that the only way to add an onPaste
event to an input element is to use HTML:
<textarea id="text_area" onpaste="on_paste" />
rather than being able to attach the event handler using JavaScript:
document.getElementById('text_area').onPaste = function() { alert('I iz in ur textbox, pasting some text') };
The MSDN website says you can only add event handlers for onPaste
using jscript or HTML, but I want to do it in JavaScript. Is there any way to do this?
- jScript is JavaScript - it's just what Microsoft calls its implementation. – MrWhite Commented Jan 26, 2012 at 14:47
2 Answers
Reset to default 3Try lowercase:
document.getElementById('text_area').onpaste = ...
It is down to capitalisation, you want:
document.getElementById('text_area').onpaste = function() { alert('I iz in ur textbox, pasting some text') };
本文标签: internet explorerIE onPaste event using JavaScript not HTMLStack Overflow
版权声明:本文标题:internet explorer - IE onPaste event using JavaScript not HTML - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741824968a2399588.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论