Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
How to use an if or condition statement to hide/not display href link and text from .json file using javascript

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!