Javascript Variable on Internet Explorer

8 07 2007

Javascript variable name can not be same as DOM element id name on Microsoft Internet Explorer. If it same, it will caused error on IE.

Example:

This example will caused error on IE.

<div id="varFoo" >Foo Bar</div>
<script type="text/javascript">
varFoo = document.getElementById('varFoo');
alert(varFoo);
</script>

Actions

Information

Leave a comment