• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

How can I hide <img> if no link URL supplied by Web App using Jquery or CSS?

Explorer ,
Feb 23, 2017 Feb 23, 2017

Copy link to clipboard

Copied

My client is listing various suppliers on their website and wants to link off to their relevant social media channels.

Some suppliers have more social media channels than others -  I'm using web apps and the detail page layout to display the information.

If a URL link to a social media channel is assigned to an image on the detailed page, how can I hide this image if no URL is detailed/provided in the relevant web app field?

I need to try and achieve this with Jquery or CSS as I can not use Liquid on this website due to laying out in Muse.

Any help is greatly appreciated.

Thanks!

TOPICS
Web apps

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Feb 23, 2017 Feb 23, 2017

Sure thing, render the web app into a hidden DIV straight after that use some javascript that loops the web app HTML DOM elements and removes whatever has "no data". Once competed unhide the DIV.

Votes

Translate

Translate
Guide ,
Feb 23, 2017 Feb 23, 2017

Copy link to clipboard

Copied

Sure thing, render the web app into a hidden DIV straight after that use some javascript that loops the web app HTML DOM elements and removes whatever has "no data". Once competed unhide the DIV.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 18, 2017 Mar 18, 2017

Copy link to clipboard

Copied

LATEST

You likely should be hiding it with liquid mark up.

If you add this tag it will hide it's self when it fails to load without jQuery.

<img onerror='this.style.display = "none"'>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines