开发者

Help with a regular expression for a jquery selector

开发者 https://www.devze.com 2023-01-16 08:46 出处:网络
Need help writing a regular expression to match any class containing the phrase block-container I\'ve come up with this: \'[class^=block-container]\' but I need help writing the wild ca开发者_Python

Need help writing a regular expression to match any class containing the phrase block-container

I've come up with this: '[class^=block-container]' but I need help writing the wild ca开发者_Python百科rds around the phrase block-container.

Examples i need to match:

 nav-block-container-left
 block-container-whitebox
 right-block-container


$("[class*=block-container]")


You're so close! This is what you want, the *= selector. http://api.jquery.com/category/selectors/

Like this:

$('*[class*=block-container]').fadeOut();

I tested it on a page that has . And then did: $('[class=opmen]').fadeOut();

And it faded out the topmenu div.

0

精彩评论

暂无评论...
验证码 换一张
取 消