`
dreamoftch
  • 浏览: 485073 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

jquery的hover方法不能用"_"开头

 
阅读更多

今天用jquery 的 hover 方法的时候,在火狐上正常,在IE上不会改变背景色。。。

 

<style type="text/css">
		._hover {background-color: gray;}
</style>

 jquery代码:

为了避免冲突,我在hover前面加了_,即: _hover作为class

$("#_content tr").hover(
			  function () {
				$(this).addClass("_hover");
			  },
			  function () {
			    $(this).removeClass("_hover");
			  });

 但是却导致了FF正常,IE不正常。

 

后来实在想不通,就改了一下class,把_去掉试试,果然是这个原因。。。尼玛

 

<style type="text/css">
		.hover {background-color: gray;}
	</style>

 

$("#_content tr").hover(
			  function () {
				$(this).addClass("hover");
			  },
			  function () {
			    $(this).removeClass("hover");
			  });

 OK。。。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics