五百行是相当多的,让我明白了,你可能会在运行一些性能问题。您可以尝试提供更具体的选择器开始。试试这个,例如:
jQuery('td.c2').hide();
或添加ID到你的餐桌,使之更加具体
jQuery('#yourTableId td.c2').hide();
您也可能会发现这篇关于jQuery选择性能非常有用:
基于什么是ING在那篇文章中说,你很可能是最好做这样的事情的:
jQuery("#yourTableId").find("td.c2").hide();
// Or if you intend to do more than one operation on your set of elements,
// cache the set of elements in a variable, so that the selector is only run once
var myElements = jQuery("#yourTableId").find("td.c2");
myElements.hide();
myElements.remove(); // Do some other stuff to your elements
// Or make use of the chaining
jQuery("#yourTableId").find("td.c2").hide().remove();
需要多长时间50行? – ManseUK 2012-02-09 10:38:19
我测试它在铬,50行hm ... <1秒 – 2012-02-09 10:44:38