I'm building a theme with html/css and liquid. The user can determine if a image should have an url or not. That's pretty easy to achieve with:
<a href="{{ klant_logo.logo_url }}" target="{{ klant_logo.nieuw_tabblad }}" > <img src="{{klant_logo.logo_klant.src | img_url: 500, quality: 70 }}" alt="logo"/></a>
BUT, when the user doesn't add a url, the above code generates this as HTML which is still clickable and navigates to the top of the page (like with href="#">.
Is there a way (HTML, Jquery, i don't know) to make href="" only clickable if it has an actual url between the brackets?
EDIT: thanks for the quick reply's! This dit the trick:
{% if klant_logo.logo_url != "" %}
<a href="{{ klant_logo.logo_url }}" target="{{ klant_logo.nieuw_tabblad }}" > <img src="{{klant_logo.logo_klant.src | img_url: 500, quality: 70 }}" alt="logo"/></a>
{% else %}
<img src="{{klant_logo.logo_klant.src | img_url: 500, quality: 70 }}" alt="logo"/>{% endif %}