This works in every browser I've tested except IE

My .js

document.getElementById("location").innerHTML = object.city;

My html

<div  id="location" class='text1' ></div>

I've spent hours searching the web, but have found no solution.
Any advise?
Thanks

Recommended Answers

All 2 Replies

make sure that is no element with name="location" either. As an example, the following would not work as you expect in IE:

<script type="text/javascript">
window.onload=function(){
	document.getElementById('location').innerHTML='hi'
};
</script>
<input name="location" />
<div id='location'></div>

the getElementById() incorrectly returns a reference to the INPUT instead of the div.

If hielo's solution doesn't work, paste your entire web document so we can further troubleshoot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.