How do I make an element appear with javascript without overriding style? -


i have following code display div hidden:

document.getelementbyid('thediv').style.display = 'block'; 

the problem when execute this, div loses prior css formatting. there way can have same functionality while keeping css formatting?

setting style.display block has no effect on other css formatting. 1 exception can think of if item display:inline, setting display:block change layout. but, other css items unaffected.

if not observing, may not telling whole story here , else aren't showing code must going on. if that's case, please try reduce test case small example in jsfiddle can see actual code causes problem.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -