Update to onpaste

As I posted yesterday, onpaste is Internet Explorer’s handler for detecting a user’s pasting into a textarea or input. However, Internet Explorer seems to fire onpaste before the actual paste of text occurs in some circumstances, which makes the whole event irrelevant. Luckily, there’s a quick fix: make onpaste run your function on a timeout.

Here’s a quick example:

function iePasteDelay(){
setTimeout(’pasteIt()’,1)
}
function pasteIt(){
// your paste function
}

and in the code…

<textarea onpaste="iePasteDelay()"></textarea>

That one millisecond delay is enough to force Internet Explorer to run your function after the actual text has been pasted. Problem solved.

Comments are closed.

I'm Reading…
Search This Site

AddThis Feed Button

Need great hosting?

Categories