Answer the question
In order to leave comments, you need to log in
Why doesn't focusout c input work?
It seems to work .. What am I doing wrong?
$("input[name='name']").focusout(function(){
if($(this).val() = ''){
$(this).val("new_val");
}
});
Answer the question
In order to leave comments, you need to log in
I understand that you were interested in blur, not focusout.
And also you don't know that = is an assignment sign, but == is a comparison. In general, you can shorten the entry:
$("input[name='name']").blur(function(){
if(!$(this).val()) $(this).val("new_val");
});
$("input[name='name']").blur(function(){
$(this).val() || $(this).val("new_val");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question