Key press adds class to element
# April 22, 2009 at 12:55 am
Basically what I have is a textarea and then a list of the letters of the alphabet in <li> tags. What I want to do is whenever a particular key is pressed, a class is assigned to that li element. For example, whenever the letter c is pressed, a class is assigned to the <li>c</li> tag. Also, when the key is let off, that class gets removed.
Can someone help me get on the right track?# April 22, 2009 at 8:41 pm
If I understand what you’re talking about, the following code should do the trick:Code:
Sorry to be so negative, but they guy is trying to learn about events and you completely overlooked event arguments that are passed with each keypress event.# May 13, 2009 at 10:49 am
# May 21, 2009 at 10:55 am
Ya i dunno y it posted that, i posted the right one above. been havin some problems with this forum for some reason lately. Anyways changed it to what it was supposed to be. Anyone else having the issue where u need to log in like 3 times in order to post? lol. yes cookies are on. dunno 0_o
You must be logged in to reply to this topic.