Flo*_*rin 8 jquery css-selectors
jQuery('td[class=bgoff]').each(function() {
var td = jQuery(this);
... no apply selector to "this" only
});
Run Code Online (Sandbox Code Playgroud)
我正在使用html中的表格数据并尝试解析每个TD的内容(它们不是唯一可识别的).
使用XPath,我可以将"this"的路径添加到其他选择中.
我怎样才能用jQuery实现这一目标?
Joe*_*oel 15
如果您已经有一个想要搜索的jquery对象,也可以使用.find(expression).
在你的例子中:
jQuery('td[class=bgoff]').each(function() {
var td = jQuery(this);
$(td).find( <selector to search within td> );
});
Run Code Online (Sandbox Code Playgroud)