jquery - 选择器类型减去名称

时间:2012-08-29 21:54:48

标签: jquery jquery-selectors

  

可能重复:
  Select elements with class except one with specific id

我必须选择一个表单的类型选择,但我想丢弃一个名称像一个单词的ID。

我有:

 $("select").onchange(function(){
   alert("change");
 });

我想要

的类型
$("select minus select with ID like 'noChange'").onchange(function(){
   alert("change");
 });

Tnx tnx

1 个答案:

答案 0 :(得分:5)

使用:not()

$("select:not(#noChange)").onchange(function(){
   alert("change");
});

或者,如果noChange是ID的一部分而不是确切的ID:

$("select:not([id*='noChange'])").onchange(function(){
   alert("change");
});
相关问题