The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Key press adds class to element Re: Key press adds class to element


If I understand what you’re talking about, the following code should do the trick:



  • c
  • d

This uses the jQuery JavaScript library, but all of this would still be possible otherwise, but much harder. If I need to explain the code, just let me know. Sometimes I know I just want to see a working example and I’d rather find out how it works myself (hopefully it will work, I only tested it in Firefox).