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


The following code gives problem on IE

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

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


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


Either capture it within the value attribute like below 

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


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

like <div id='abc' class='hidden'></div>  
Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus