Skip to content

Instantly share code, notes, and snippets.

@versluis versluis/vanish.html
Last active Apr 10, 2019

Embed
What would you like to do?
Make empty links disappear from the DOM
<p class="one"><a href=''>This line shall vanish.</a></p>
<p class="one"><a href='https://versluis.com'>This line shall prevail.</a></p>
<p>The End.</p>
<script>
// make empty links vanish
$('.one a').each(function() {
if(!$(this).attr('href')) {
$(this).parent().hide();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.