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?

Kim Tran
1#
Kim Tran Published in 2017-01-06 04:39:17Z
 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 

undefined
2#
 You don't need JavaScript for this: .nolinkdiv { display:none; } ul li a[href=""] { display: none; } ul li a[href=""] + div { display: block; } 
 $( document ).ready(function() {$('ul li').each(function(idx, li) { var LI = \$(this); var hrefValue = LI.find("a").attr('href'); if(hrefValue) { LI.find("div").hide() } else { LI.find("a").hide() } }) });