'IE onPaste event using JavaScript not HTML
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?
Solution 1:[1]
It is down to capitalisation, you want:
document.getElementById('text_area').onpaste = function() { alert('I iz in ur textbox, pasting some text') };
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | andynormancx |
