I have a definition list and I need to delete all the <dt>
tags who doesn't have any <dd>
In this particular case: Herramientas, Suplementos, Repuestos, Herramientas and Anti pinchaduras
The list can vary wildly because it's stock dependent (any category <dt>
can get empty)
I tried this
$('dt+dt').each(function() {
$(this).remove();
});
But it deletes "partes" instead of "herramientas" and fails to delete "suplementos"
Also tried with :empty
but it seems like a dt without a dd isn't considered empty...
There must be a extremely simple and easy solution but my brain refuses to see it :-(
Example list:
<dl>
<dt>Bicicletas</dt>
<dd><a href="/bicicletas/">Bicicletas</a> (70)</dd>
<dt>Accesorios</dt>
<dd><a href="/accesorios/bocinas/">Bocinas, timbres y cornetas</a> (9)</dd>
<dd><a href="/accesorios/transporte/">Transporte y protección</a> (1)</dd>
<dt>Herramientas</dt>
<dt>Partes</dt>
<dd><a href="/partes/cubiertas/">Cubiertas</a> (2)</dd>
<dd><a href="/partes/asientos/">Asientos</a> (5)</dd>
<dd><a href="/partes/grips/">Puños / grips</a> (1)</dd>
<dt>Articulos de indumentaria</dt>
<dd><a href="/indumentaria/jerseys/">Jerseys / Remeras</a> (1)</dd>
<dd><a href="/indumentaria/cascos/">Cascos</a> (3)</dd>
<dt>Suplementos</dt>
<dt>Repuestos</dt>
<dt>Herramientas</dt>
<dt>Anti pinchaduras</dt>
</dl>