Jump to content

show innerHTML content as a table


elcaiaimar

Recommended Posts

Hello!

 

I have a map in my website and when I click on it, if there is a feature, it shows its information. This information is written by an innerHTML and currently it looks like that:

if (feature) {                var objeto = feature.getProperties(),                propiedades;                var propiedades;                content.innerHTML = "";                for (propiedades in objeto){                    content.innerHTML += propiedades + ':' + objeto[propiedades] + "<br />";                }                return container.style.display = 'block';            } else {              return container.style.display = 'none';            }

So the info is shown ok but a little untidy. So I would like to show this info with a table.

propiedades contains the name of the data and objeto[propiedades] their values.

 

Could anybody tell me how to do it or give me an example please?

 

Thank you in advance!

Link to comment
Share on other sites

Obviously you could try...

content.innerHTML += '<table><tr><td>'+ propiedades + '</td><td>' + objeto[propiedades] + "</td></tr></table><br/>";
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...