Home Hide link if href is blank, and then display a different button?

# Hide link if href is blank, and then display a different button?

user3962
1#
user3962 Published in September 20, 2018, 12:45 pm

I have a link and div within each of my list items. If the link HAS an href then I want to make sure the div is hidden within its list item and the link appear just normal.

However if the link DOES NOT have a href (e.g. href=""), then I want to add the class .show to the div so I can show it. I also want to hide the link at the same time.

Or is there a better way to do this? Thanks

<style>
.show { display:block!important; }
</style>

<ul>
<li>
<a href="/register.html">Register</a>
</li>
<li>
<a href="">Register</a>