You can get the value
attribute directly since you know it's an
element, but your current usage of .val() is already the current one.
For the above, just use .value
on the DOM element directly, like this:
$(document).ready(function(){
$("#txt_name").keyup(function(){
alert(this.value);
});
});