hikin 发表于 2013-2-7 22:14:41

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测试通过
 
页: [1]
查看完整版本: IE8下, jQuery :hidden函数在TR上的bug与解决方法