Use .val():console.log( $('#input').val() );
$(function(){
$("#DoIt").click(function(){
$('#input').val('final');
console.log($('#input').val());
alert($('#input').val());
});
});
demo
EDIT
Now I understand what you are looking at: inside the source of an element (verification element) in Firebug.
Well, if you want the changes to really happen, you have to use:
$('#input').attr('value','final');
instead:
$('#input').val('final');
otherwise, the change is stored by the browser (fear nothing), but Firebug is not updated.
in this demo you can see it working:
$("#DoIt").click(function(e){
$('#input').attr('value','final');
console.log( $('#input').val() );
alert( $('#input').val() );
return false;
});
source
share