I have a code snippet in a div with scrolling overflow.
When the user clicks on the text, I want it to highlight it all for them.
Is this possible? Couldn’t find anything apart from highlighting input text.
[CODE]<html> <head> <script type="text/javascript"> function highl() { var x = document.getElementById('mytext').innerHTML; var highlight = "<span style='background: yellow;'>"+x+"</span>"; document.getElementById('mytext').innerHTML = highlight; } </script> </head> <body> <div id="mytext" onclick="highl();">text,text,text,text,</div> </body> </html>[/CODE]
Help @Mig spread the word by sharing this article on Twitter...