Been on this one for a while now. Basically, I need to check where a href
on an anchor tag with the class .pdf-download
is empty, and if it is, hide it.
I have attempted a few options but with no luck. This is what i have so far:
$("a.pdf-download").each(function (i) {
if ($('[href]:empty',this).length == 1) {
$(this).hide();
} else {
$(this).show();
}
});
I am a jquery beginner myself, but thats how I would do it:
$("a.pdf-download").each(function (i) {
var aHref = $(this).attr('href');
if (aHref == '' || !aHref) {
$(this).hide();
};
});
Demo: http://jsfiddle.net/BZq9c/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With