views:

56

answers:

3
$('#a').keyup(
  function(event){
   alert(event.keyValue)
  }
)

but error,coz 'keyValue' is not undefined,

how do i get the keyValue when the event keyup???

i use jquery.

thanks


i do this:

$('#a').keyup(
  function(event){
   alert(String.fromCharCode(event.which))
  }

but it alert the value of upper

ex:

i alert I

l alert L

why??? )

+1  A: 

try event.keyCode instead

Marius
A: 

Check out this question: jQuery Event Keypress: Which key was pressed?

PetersenDidIt
+1  A: 

JQuery places the key pressed into event.which across all browsers.

See here: http://api.jquery.com/keyup/

To determine which key was pressed, we can examine the event object that is passed to the handler function. While browsers use differing attributes to store this information, jQuery normalizes the .which attribute so we can reliably use it to retrieve the key code

pygorex1