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.
セルを含むテーブルがあり、各セルにはデータ型があります。フィルタバーがあり、フィルタオプションが選択されている場合、選択されたオプションではないデータ型のすべてのdivを非表示にします。
これを行うための最良の方法は何ですか?
あなたのdivには「データ型」属性があると推測しているので、次のようなことができます:
$('div[data-type!="yourvalue"]').hide();
セレクターが最初に属性が何かに設定されているすべての要素を取得し、次に一致しない要素を選択するようにしますvalue
value
$('div[data-type][data-type!="value"]').hide();