我想写一个优雅的解决方案,通过在不同的上下文列表中搜索来选择相同的标签
//i have this not editable code
var c1$ = $('#context1'),
c2$ = $('#context2'),
c3$ = $('#context3');
//I want to improve the code and 'only from here on
var selector = 'a.select';
c1$.find(selector).css('color','red');
c3$.find(selector).css('color','red');我正在为任意数量的上下文寻找解决方案
发布于 2012-05-02 07:15:57
为什么不加载一个上下文列表,然后执行foreach来查找每个上下文中的“a.select”?
https://stackoverflow.com/questions/10404539
复制相似问题