onkeydown() and val() does not work together...

onkeydown() and val() does not work together...

Hello,

I quickly wrote a little script that hide a label that is under an input if its val() is not blank, checking it with an onkeydown. Here it is :
  1. $(".field-container .field").css("value", "");
  2.     $(".field-container .label-text").show();
  3.     if ($(".field-container .field").val() != "")
  4.         $(".field-container .label-text").hide();
  5.     checkEmpty = function() {
  6.         if ($(".field-container .field").val() != "") {
  7.             $(".field-container .label-text").hide();
  8.         } else {
  9.             $(".field-container .label-text").fadeIn();
  10.         }
  11.     };
  12.     $(".field-container .field").bind("focus blur keydown change",function() {checkEmpty();});
I want the same thing as this plug-in, but I am doing it a different way (this example at the end, just before comments).

My script does not work properly because of the onkeydown() and val() association : the val() function called on an onkeydown return the old value, not the updated one (wich is updated after an onkeyup). But the plugin above uses the same method, and it works ! How can it be possible !

I am on it since now 2 days... Little help appreciated !

Thanks in advance !

Note : excuse my English !