I've a list of elements and each one of them have a number of types. I need to check whether this types have a certain text, if not hide the type. This should hide the types in question not the others.
The structure is:
<div class="element1">
<dd class="event_types">
<a>Campaigns</a>
|
<a>Clubs</a>
</div>
<div class="element2">
<dd class="event_types">
<a>Club</a>
|
<a>Other</a>
|
<a>Campaigns</a>
</div>
This is what I've tried but hides all of the types if one of them is not true
var allowed = ["Sport", "Clubs", "Campaigns"];
$('.event_types a').each(function () {
var typeText = $(this).text();
if (allowed.indexOf( typeText ) > 0) {
$(this).hide();
}
});