您现在的位置是:首页 > 电脑技术查询 > web开发

jquery怎么写类似a:hover这种的css

编辑:chaxungu时间:2022-10-02 23:14:27分类:web开发

jquery如何写类似a:hover这种的css
比如CSS
a:hover { color:white; }

那如何使用jquery写这个语句呢?
$('a').css('color', 'white')仅相当于a { color:white; }

------解决方案--------------------
$('a').hover(function(){$(this).css('color','white');},
function(){$(this).css('color','#fff');});