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: 
You are having problems with the variable scope. `this` refers to the inner function..

Use this instead:

```
$("input").on("keypress", function () {
    var that = this;
    setTimeout (function () {               
        var search_word =  $(that).val();
        if ( search_word.length > 0 ) {
            alert(search_word);
        }
    },200);
});​

```

[**JSFIDDLE**](http://jsfiddle.net/vwuGt/)
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());
});​

```