0

is it possible to run a command in javascript when someone paste text into a textarea? What i am trying to do is make a remove format command in the text editor run when they paste. And if it is possible make it run the command on the text without having to highlight it.

the reason why i am trying to do this is cause word sucks. it adds all kinds of crap to formatted text which causes problems as you know. I would just paste it into a notepad but i know my customers don't want to take that extra step.

thanks in advance

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Troy III
0

is it possible to run a command in javascript when someone paste text into a textarea? What i am trying to do is make a remove format command in the text editor run when they paste. And if it is possible make it run the command on the text without having to highlight it.

the reason why i am trying to do this is cause word sucks. it adds all kinds of crap to formatted text which causes problems as you know. I would just paste it into a notepad but i know my customers don't want to take that extra step.

thanks in advance

For as much as I understand your question - you want to remove html format from the clipboard content before it is pasted.

If you are developing for IE
there's an "onbeforepaste" event handle - but if you are developing for IE you will not need it.

1.copy-paste this code in location bar in IE. javascript: var a = clipboardData.getData('text'); document.write(a); 2.Than select and copy any code in the document under, or any other window.
3. hit "enter" - the copied content will be written in a new page as plain unformatted text.

this code is IE only!

Edited by Troy III: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.