john
john

Reputation: 801

hide div where class name with jquery

I want to hide the div using jQuery

I've tried the following

$('.field-item div.class:contains(Country||count||family)').css('display', 'none');

not happen.

My html code is as follows

<div class="field-item">
    <div class="family">@types.family</div>
    <div class="name">@types.name</div>
    <div class="Count">@types.Count</div>
    <div class="Country">@types.Country</div>
</div>

Upvotes: 2

Views: 12761

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

:contains() is used to filter based on the text content of an element

Looks like you are trying to hide 3 divs then use multiple selector

$('.field-item').children('.Country, .Count, .family').hide();

Demo: Fiddle

Upvotes: 4

Related Questions