AND选择器jQuery [英] AND selector jQuery

查看:103
本文介绍了AND选择器jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在jQuery中使用AND选择器?我正在尝试通过需要多个选择器为真的结果进行过滤.这是我使用的,而不是"OR",所以我要使用"AND"代替,".

Is it possible to use an AND selector in jQuery? I am trying to filter through results where I need multiple selectors to be true. This is what I use but instead of "OR" so the "," I use I want to use "AND".

$('div.job:not([data-province="'+province+'"])', 'div.job:not([data-employment="'+employment+'"])', 'div.job:not([data-education="'+education+'"])', 'div.job:not([data-branch="'+branch+'"])').fadeOut('slow');

推荐答案

是的,您实际上是在寻找combined attribute selector.

Yes you can do that, you are actually looking for combined attribute selector.

尝试

$('div.job[data-province!="'+province+'"][data-employment!="'+employment+'"][data-education!="'+education+'"][data-branch!="'+branch+'"]').fadeOut('slow');

这篇关于AND选择器jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆