I have this HTML piece of code and I want to display:none on the class ss_label of which it has value From:, To:, Departing: and Returning:. The last 3 that has an extra class of ss_label_adult, ss_label_child and ss_label_inf, I want them to be displayed correctly.
The HTML is retrieved from an API so I can’t change the way it is.
<table cellspacing='0' class='ss_sp_as'>
<tbody>
<tr class='ss_sp_sc_from'>
<td class='ss_label'>
From:
</td>
<tr class='ss_sp_sc_to'>
<td class='ss_label'>
To:
</td>
</table>
<table cellspacing='0' class='ss_sp_dates'>
<tbody>
<tr class='ss_sp_sc_to'>
<td class='ss_label'>
Departing:
</td>
<tr class='ss_sp_sc_to'>
<td class='ss_label'>
Returning:
</td>
</table>
<table cellspacing='0' class='ss_sp_pass'>
<tbody>
<tr class='ss_sp_sc_to'>
<td class="ss_label ss_label_adult">
</td>
<td class="ss_label ss_label_child">
</td>
<td class="ss_label ss_label_inf">
</td>
</table>
The only way I could think of doing this, is by display:none dynamically to the ones that haven’t got more classes? Does that makes sense?
Thanks alot
These elements that should be hidden have multiple class names, where the elements which have to be hidden have only one class name. So, this expression should work:
.ss_labelelements are selectedss_labelare kept, the others are ignored.displayproperty which valuenone.Fiddle: http://jsfiddle.net/QGSsG/