Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これをjQueryに変換する方法-「兄弟にclass="foo"の要素が含まれていない場合は、何かを実行してください...」
それはあなたがそれを言う方法とほとんど同じです:
if ($(element).siblings('.foo').length == 0) { }
クラス'foo'の要素の兄弟が存在しない場合は、...を実行します。
参照:siblings(selector)
siblings(selector)
これを試して、
var siblingssWithoutFooClass = $('#elementId').siblings().not('.foo');