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,

tr.style.display = ‘block';

And in Chrome/Firefox, the Javascript code would be,

tr.style.display = ‘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,

tr.style.display = ”; // not a double quote, but 2 single quotes

Leave a Reply

Pay with PayPal

Icon Web Solutions Service
Other Amount:
Name:

Testimonials

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

REQUEST A QUOTE

Request A Quote

Please fill the form to request a quote from us

Name (required)

Email (required)

Phone

Services
 Website Design & Development Logo Design SEO SMO Payment Gateway Integration Others

Any Other Detail

Input Text Shown in Image
captcha