I have a series of links being generated and some have a blank href. I want to .hide the blanks or maybe even if it appears to have a # using Jquery and/or CSS
The links look like
<a class="Highlighted" id="hyperlinkViewProfile" href="">text to hide</a>
With CSS:
A[href=""], A[href="#"], A:not([href]) {
display: none;
}
This works for links with no href or with href="#". If you want to match links with a # anywhere in the href, use A[href~="#"]
Didn't test in old browsers, you may resort to jquery selectors in that case.
DEMO
$('a').filter(function(){return $(this).attr('href') === "" || $(this).attr('href') === "#"}).hide();
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