Skip to content Skip to sidebar Skip to footer

Style="display:block;" Works In Chrome But Not Safari

I have a banner on my website that by default is not shown. The code I am using to get it to show is document.getElementById('cookie1').style = 'display:block;' This works in Ch

Solution 1:

From testing this in Chrome and Safari, it seems Chrome is more forgiving in that it parses the style string and puts the right style in place for you, but Safari does not.

Try:

document.getElementById("cookie1").style.display = 'block';

It's probably best to be explicit like that anyway, instead of relying on string parsing for the style itself.

Post a Comment for "Style="display:block;" Works In Chrome But Not Safari"