我想要做的是選擇文檔上的所有輸入按鈕,除了那些位於特定ID下的按鈕。如何選擇除特定ID以外的所有輸入?
實施例:
<body>
<input type="button">
<div id="something">
<input type="button">
</div>
<div id="something2">
<input type="button">
</div>
<input type="button">
<input type="button">
<input type="button">
</body>
例如,我想選擇所有的輸入,除了那些位於下<div>
其id
是「東西」。
我已經試過:
1) $('input[type="button"]:not(:parent(#something))').addCSS();
2) $('input[type="button"] :not(#something input[type="button"])')
與其他類似的方法
[JQuery Selector for not「wrapped」elements]的可能的重複(http://stackoverflow.com/questions/11924672/jquery-selector-for-not-wrapped-elements) – Blazemonger 2013-02-27 21:12:36