简体   繁体   中英

How to select div which has particular element in class?

How to hide a div if its class has particular element. Here is my code.

<div id="admin-menu" class="admin-menu-site-localhost admin-menu-processed admin-menu-position-fixed" style="position: fixed;">
    <div id="admin-menu-wrapper"></div>
</div>

I need to select div with menu as element. Because menu is appended to some other element. How can I filter those div's?

UPDATE: I have tried the following, but it didn't work:

jQuery("body")hasClass("div[class*='menu']");

This should return all div elements that contains menu in className property:

$('div[class*="menu"]')

or

jQuery('div[class*="menu"]')

try this:

$('[class*="menu"]').doSomething();

This will select any element that has menu in it's class list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM