Question: Am experimenting with an anonymous function :

```
var a:Object = new Object() ;
a.b = new Function()

a.b =function()
{
    trace("hello");
}

trace(a.b())

```

Output : 
hello
undefined

What's undefined ??

Answer: 
```
$("input").on("keypress", function (e) {
    alert(String.fromCharCode(e.which));
});

```
You could use keyup, it's fired after the input got the value, so you don't need a timeout.
<http://jsfiddle.net/yF2hU/>

```
$('#foo').bind('keyup', function(e) {
    alert($(this).val());
});​

```