Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:50:53+00:00 2026-05-27T04:50:53+00:00

I’m trying to generate some HTML content for a google maps infowindow. I have

  • 0

I’m trying to generate some HTML content for a google maps infowindow. I have 7 values which is supposed to be displayed if they do not equal null, undefined or “” (empty string).

But apparently my if(e.Property != null || e.Property != "undefined" || e.Property == "") doesn’t work when a Property is undefined. Mostly the case is that e.Email is undefined. So instead of skipping that part, my code still inserts the html + "<br /> part. And when I alert() the e.Email it returns undefined which it’s supposed to catch and skip if that was the case.

I have tried writting if(typeof e.Property != null || typeof e.Property != "undefined" || typeof e.Property == ""), but that made no difference.

// 'e ' is JSON object
var generateHTML = {
    init: function(e) {
        if (e != null || e != "undefined"){
            generateHTML.check(e);
        }
    },
    check: function (e) {
        if(e.Title != null || e.Title != "undefined" || e.Title == ""){
            html = html + "<b>"+e.Title+"</b>";
        }
        if(e.Address != null || e.Address != "undefined" || e.Address == ""){
            html = html +"<br />"+ e.Address;
        }
        if(e.Zipcode != null || e.Zipcode != "undefined" || e.Zipcode == ""){
            html = html +"<br />"+ e.Zipcode+", ";
        }
        if(e.City != null || e.City != "undefined" || e.City == ""){
            html = html + e.City;
        }
        if(e.Phone != null || e.Phone != "undefined" || e.Phone == ""){
            html = html +"<br />"+ e.Phone;
        }
        if(e.Email != null || e.Email != "undefined" || e.Email == ""){
            html = html +"<br />"+ e.Email;
        }
        if(e.WebAddress != null || e.WebAddress != "undefined" || e.WebAddress == ""){
            html = html +"<br />"+ e.WebAddress;
        }
        return html;
    }
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:50:53+00:00Added an answer on May 27, 2026 at 4:50 am

    If you want a more shorthand version you can just use:

    if (e.Title) {
        // add to HTML
    }
    if (e.Address) {
        // add to HTML
    }
    

    You may want to consider building your HTML as an Array and then joining at the end to avoid creating many strings, e.g.

    var html = [];
    html.push("FirstName");
    html.push("<br />");
    html.push("LastName");
    html.push("<br />");
    html.push("Number");
    var output = html.join(""); // "FirstName<br />LastName<br />Number"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.