I want to select onclick the innerHTML of a td so the user can just do ctrl+C to copy the content.
I tried many combination and I can't find a way. However it seams to work on inputs with a simple document.getElementById(id).select();
Adding a focus don't effect anything, and the .select() send and error:
document.getElementById(...).select is not a function
So how can I do with a td element? I don't mind if it's not working on IE.
Or if possible, directly copying the text.