最佳答案
尝试使用removeAttr()就像,
$('input,textarea').focus(function(){
$(this).removeAttr('placeholder');
});
要在 blur()
上再次获取占位符值
,请尝试以下操作,
$('input,textarea').focus(function(){
$(this).data('placeholder',$(this).attr('placeholder'))
.attr('placeholder','');
}).blur(function(){
$(this).attr('placeholder',$(this).data('placeholder'));
});
关于javascript - 如何删除焦点上的占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19676084/