I got:
$(someTextInputField).keypress(function() {
alert($(this).val());
});
Now the alert always returns the value BEFORE the keypress (
Try something like this:
$('#someField').keypress(function() {
setTimeout(function() {
if ($('#someField').val().length > 0)
$('#theButton').attr('disabled', false);
}, 1);
});
That simply introduces a timeout so that after the "keypress" event loop completes, your code will run almost immediately thereafter. Such a short timer interval (even if rounded up by the browser) will not be noticeable.
edit — or you could use "keyup" like everybody else says, though its semantics are different.