Mozilla / Firefox equivalent to IE onpaste for textareas

M

Mark Szlazak

Is there anything for Mozilla or Firefox that would be equivalent to
IE's onpaste event for a textarea?
 
M

Mark Szlazak

Mark said:
Is there anything for Mozilla or Firefox that would be equivalent to
IE's onpaste event for a textarea?

I should add that using onchange presents a problem since the event
doesn't fire until the textarea looses focus. Whatever solutions that
exist need to work like onpaste without the focus issues of onchange.
 
D

DU

There is no equivalent to onpaste event for a textarea, as far as I
understand your post.
"Fires on the target object when the user pastes data, transferring the
data from the system clipboard to the document."
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onpaste.asp
I should add that using onchange presents a problem since the event
doesn't fire until the textarea looses focus. Whatever solutions that
exist need to work like onpaste without the focus issues of onchange.

Maybe if you could provide an url showing how your script works for
MSIE, I could have a look at it and maybe propose an alternative.

DU
 
M

Mark Szlazak

DU said:
Maybe if you could provide an url showing how your script works for
MSIE, I could have a look at it and maybe propose an alternative.

DU

Thanks for the offer DU but I do have alternatives. However, I need to
seriously consider this particular option if a viable one exists.
 
M

Martin Honnen

Mark said:
Is there anything for Mozilla or Firefox that would be equivalent to
IE's onpaste event for a textarea?

You could try to use
<textarea oninput="..."
with Mozilla, of course it doesn't fire only for text being pasted but
also for other text manipulation like cutting text but at I think it is
the only event handler in Mozilla and HTML documents being fired when
text is pasted into a text control.
 
M

Mark Szlazak

Martin said:
You could try to use
<textarea oninput="..."
with Mozilla, of course it doesn't fire only for text being pasted but
also for other text manipulation like cutting text but at I think it is
the only event handler in Mozilla and HTML documents being fired when
text is pasted into a text control.

That will work just fine. Thanks.
 
C

Csaba Gabor

Martin said:
You could try to use
<textarea oninput="..."
with Mozilla, of course it doesn't fire only for text being pasted but
also for other text manipulation like cutting text but at I think it is
the only event handler in Mozilla and HTML documents being fired when
text is pasted into a text control.

frm.ctlName.addEventListener("DOMCharacterDataModified",
function(e){myEventHandler(e);}, false);

This method works, but it has several minor bugs which I logged at:
https://bugzilla.mozilla.org/show_bug.cgi?id=285272

Also, note that if you do something like select the 5 in 54321
and then press 6 (changing the text to 64321) you will fire twice:
The first time the value will be 4321,
and the second firing will have 64321

Csaba Gabor from Vienna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top