Today I wanted to follow along in the lyrics with a tune I was enjoying on Pandora, so I searched for the last word in the song I heard. The browser scrolled to the section of the song where the word was located, however, the word was not highlighted. I tried to select the lyrics, and was annoyed to find the lyrics were not selectable. It was then time for a little JavaScript magic to make it possible to select, copy, and paste the lyrics.
Fortunately, the Pandora website uses jQuery, which makes it stupid easy to re-enable the ability to select & copy the lyrics in a single statement. If you want to do the same, just drag this bookmarklet to your bookmark bar:
Here’s the JavaScript code that makes this possible:
$("div[class^='lyricsText']").attr({
class: "lyricsText",
unselectable: "off",
onmousedown: null,
onclick: null,
ondragstart: null,
onselectstart: null,
onmouseover: null
});
All it does is find the <div> tag in the HTML that contains the lyrics and disables all the things that disable the selection of the lyrics text. That’s a lot of disabling! Put another way, it re-enables the selection of they lyrics.