JQuery input聚焦清空值,失焦赋值
$("input[type*=text]").each(function(){ var oldValue=$(this).val(); $(this).focus(function(){ if($(this).val()==oldValue){ $(this).val(''); } }) .blur(function(){ if($(this).val()==""){ $(this).val(oldValue) }else{ oldValue = $(this).val(); } }) });