首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

IE8上, jQuery :hidden函数在TR下的bug与解决办法

2012-10-30 
IE8下, jQuery :hidden函数在TR上的bug与解决方法该问题主要产生在ie8下对tr标签隐藏后统计其个数时出现下

IE8下, jQuery :hidden函数在TR上的bug与解决方法

该问题主要产生在ie8下对tr标签隐藏后统计其个数时出现
下面是一段官方的解释:
There is an open ticket for this. It is interesting because IE says that the TR element still has a width > 0 even though it isn't displayed. If you check the TD of the hidden TR, it is hidden.

解决方法,通过行的css样式获取display值来判断当前行是否是隐藏状态
详细代码如下:

var hideCount=0;jQuery("#dataList tr").each(function(){     var curTR=jQuery(this);     var display=curTR.css("display");     if(display=="none"){        hideCount=hideCount+1;     }});

?上面方法 ie6,ie7,ie8,ff测试通过

?

热点排行
Bad Request.