I'm working on a site which pulls information from a .json file when a location on a map is selected to populate information in a content template, one of these fields contains URLs to real estate virtual walkthroughs, though not all of the properties in the .json file have Virtual Walkthrough URLs in their respective fields.
Currently the site uses:
HTML:
<li><span style="color: #0000ff;"><a href={VirtualLink} target="_blank" rel=”noopener noreferrer” style="color: #0000ff;">Real Estate Walkthrough</a></span></li>
This works fine for the properties that have a URL listed in the .json file against the property ID, however if the field is empty the link text still displays, and the link won't work as there is no URL in the .json field for the specific property.
I want to be able to use javascript in a similar manner to the Excel IF(condition, value_if_true, value_if_false), to display the text "Real Estate Walkthrough" and href link if the .json field contains a URL for the property ID selected and if the .json field is empty then to display nothing.