Chrome and Firefox Issue with row.style.display

By | December 15, 2012

I was struggling with some of my JavaScript code that was working fine with all versions of Internet Explorer, but when i tested it with Chrome and Firefox, its behavior was not understandable.Actually, I was have written following JavaScript function which hide or display a row on the basis of some criteria.

function HideShowRow()
{
………Some logic here……
…………………………………row.style.display = ‘block’; //this line of code doesn’t work properly in Chrome and Firefox………………………………………

}

Although, it was a simple and basic JavaScript code snippet but creating problem and took around an hour to sort it out.

So, in order to resolve the issue, I just replace this line with the following line and everything starts working for Chrome and Firefox as well as different versions of Internet Explorer.

row.style.display = ”; //instead of block, use empty string.

Other Related Articles:

Top 10 Interview Questions and Answers Series: