I want to check whether an element has no hrefs in it (ie it is empty) and if it is, to hide the label associated with it. There will be several elements on the page that need to be checked if they are empty so I will need to write a loop. I need help writing the loop please. Here is my code so far:
if(jQuery('span.tags').is(':empty')) {
jQuery('span.label').hide()
};
Please can someone help me with this code?
This is my HTML
<div class="entry-meta">
<span class="label">Tagged:</span>
<span class="tags">
<a href="#" rel="tag">Career change</a>,
<a href="#" rel="tag">career change e course</a>,
<a href="#" rel="tag">career help</a>
</span>
</div><!-- END .entry-meta -->
Thanks to everyone who answered this post. Thisis the solution that worked.
//Removes word 'Tagged:' if there are no tags
jQuery('span.tags:empty').prev('span.label').hide();
hrefattribute at all, or simply an emptyhref.