How can I use the IDs array to check and hide #volume2 in the example below?
<tr id="mytr">
<th id="volume1">1</th>
<th id="volume2">2</th>
<th id="volume3">3</th>
</tr>
<tr>
<th class="volume1">1</th>
<th class="volume2"></th> <-- this is empty
<th class="volume3">3</th>
</tr>
var IDs = [];
$("tr#mytr").find("th").each(function(){ IDs.push(this.id); });
I don't want to do all these if statements
if( $('.volume1').length < 1 ) {
$('#volume1').addClass('hide');
}
if( $('.volume2').length < 1 ) {
$('#volume2').addClass('hide');
}
if( $('.volume3').length < 1 ) {
$('#volume3').addClass('hide');
}