jQuery-:not()中的多个选择器? [英] jQuery - Multiple Selectors in a :not()?

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

问题描述

我似乎无法完成以下工作:

I cant seem to get the following working:

$('input:not([type=radio][type=checkbox])').live('click', function() {
    alert("You haven't clicked a radio or checkbox!");
});

尝试了几种不同的语法,有人可以帮我解决这个问题.

Have tried a few different syntax's, can anyone help me out on this one.

干杯
查理

推荐答案

您正在将多个选择器多个属性选择器.您应该写:

You're confusing the multiple selector with the multiple attribute selector. You should write:

$("input:not([type=radio], [type=checkbox])");

多重属性选择器[type=radio][type=checkbox]匹配type属性等于两者 radio checkbox的元素,在此Universe中不会发生

The multiple attribute selector [type=radio][type=checkbox] matches the elements whose type attributes are equal to both radio and checkbox, which cannot happen in this universe.

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

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