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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.