jsFiddle: Cleaning Copy/Paste Input for ContentEditable
- April 2, 2015 9:46 AM
- User Interface Design, Experiments, AngularJS, Examples & Tutorials, Javascript
- Comments (2)
This is captured in an AngularJS directive, but the process could easily be bound with jQuery instead and follow the same steps. The basics here are to stop the default paste, read the paste data as plain text, and then to replace some risky characters (necessary for my exact use case).
As noted, this example has been built for and tested in Chrome only - I know for IE, you need to potentially handle a different getData() operation.