Which is the Best Java Web Framework ?

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>  
Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.