Javascript - Problem accessing innerHTML using input type='hidden' on IE


Problem 

The following code gives problem on IE

document.getElementById("abc").innerHTML == "abc";

if element with id 'abc' is a hidden element.

Cause 

innerHTML is not intended to be used with hidden element, as it is used to generate HTML on fly.

Solution

Either capture it within the value attribute like below 

document.getElementById("abc").value == "abc";

or 

change DOM element from 'input type = hidden' to div

like <div id='abc' class='hidden'></div>