Call Us : +1-678-551-2452
+91 77381-86899

element’s style.display property hack

In order to dynamically set the
element’s style.display property from Javascript code, we need to set a different value for different browsers.

For example, in IE, the Javascript code would be, = ‘block';

And in Chrome/Firefox, the Javascript code would be, = ‘table-row';

This means that the Javascript code will have to first do a browser detection and then accordingly set the style.display value.

However, a much simpler solution is to just set the style.display property to nothing – this causes it to assume its default value (which is block for IE and table-row for Firefox, Chrome, etc.)

This is how the much simpler Javascript code would look like, = ”; // not a double quote, but 2 single quotes

Leave a Reply

Pay with PayPal

Icon Web Solutions Service
Other Amount:


It has been a great pleasure working with Icon Web Solutions on the development of my digitized logo and website. From the initial phases of web design, the Icon Web Solutions team has been a pleasure to work with
Naren, USA