Tag:

获得jQuery .filter()结果的反向/反向

我有一个.filter函数,它可以工作并标记 所有父项,其中包含一个红色的输入字段。 但是,我需要恰恰相反。 因此,返回所有不包含<input字段。 我试过if ($(this).html().indexOf(‘<input') == -1) {但这只是以某种方式标记所有行。 我的jQuery: $(document).ready(function () { $(“#ListView1_itemPlaceholderContainer table table table td”).filter(function (index) { if ($(this).html().indexOf(‘ 0) { return true; } }).closest(‘div’).css(‘background-color’, ‘red’); }); 这是我的HTML dfgdfg   @dfgdfg Follower-4578   , Following-1654 dfgdfgd   @dfgdfgdf Follower-4622   , Following-4007 我也查看了这篇文章jQuery:使用filter(),但是按照评论者的建议使用这两个结果 。 并尝试了这个: $(document).ready(function () { $.fn.invert = function () […]