Thursday, August 20, 2009

InnerText problem in firefox

its tue that innerText property does not support firefox, but it will work in IE. This is one of the issues facing on web developers. Here is my solution

below example will store 100 in label lblPremAmt.

firefox support textContent property which is equivalent to innerText in IE.

var vlblPremAmt = document.getElementById("<%= lblPremAmt.ClientID %>");

if(document.all)
{
vlblPremAmt.innerText = 100;
}
else
{
vlblPremAmt.textContent = 100;
}

No comments: