In a huge table of numbers, I made the user's experience "richer" by replacing all of the semi-visible minus signs by –
. It looks great, big improvement. I was so busy admiring my cleverness that I forgot to notice the blood on the floor.
Because, come to find out, when the guy goes to select, copy, and then paste (elsewhere) such transformed minus signs, guess what? they're not minus signs any more.
Can I use the onCopy event dependably, straightforwardly, and cross-browserly (including Mac browsers) to change those –
chars back to minus signs in the matter that was (or is about to be) copied?
If so, have you any hints on doing it?
I'm using native JavaScript, not using any framework.
I don't believe there's a way JavaScript can manipulate what is inside the clipboard because that's an OS feature. What you could do I believe is manipulate the text after the user pastes it into a field of your choosing. Here's an example with JQuery:
$('#my_text_field').bind('paste',function()
{
$(this).val($(this).val().replace('–','-'));
}