我有两列,其中一些包含“parentandsub”类的元素。
我想遍历 A 列中的每个 parentandsub 元素,并检查它是否在 B 列中。如果不是,那么我想在 A 列中突出显示该元素。
这是我的代码,但它不起作用:
$(".column2 .parentandsub").each(function(){
if ($(".column1 .parentandsub:contains('" + $(this).html() + "')").length == 0) {
$(this).wrap('<span class="parentandsubhilite" />');
}
});
感谢您的任何帮助。