在某些针对input输入框的场景中,用css .xxx:hover{}可以在没有输入时实现鼠标悬停,但是当输入了内容,又删掉后,就没有了鼠标悬停效果。这个时候可以用jq的hover()函数代替css。
$(".inputEle").hover(
function(){$(this).css("background-color","white");}
,function(){$(this).css("background-color","rgba(255, 255, 255, 0.32)");}
);