When manipulating strings in JavaScript, it is often necessary to perform certain functions to escape characters, decode them, and perform other string manipulations. JavaScript makes it easy to modify the String prototype, making it possible to create new methods on String types. As of late, I’ve preferred this method (pun intended) over creating custom functions.
Archives
- April 2012
- February 2012
- January 2012
- May 2011
- April 2011
- March 2011
- December 2010
- October 2010
- September 2010
- June 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
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.