javascript removeChild() and appendChild() VS display=none and display=block|inline

Posted by Kucebe on Stack Overflow See other posts from Stack Overflow or by Kucebe
Published on 2010-03-15T13:14:19Z Indexed on 2010/03/15 13:19 UTC
Read the original article Hit count: 351

Filed under:
|

I'm developing a web application that shows some controls and descriptions dinamically (I don't want to use jQuery or other libraries). At this moment i make appear and disappear controls using:

element.setAttribute("style", "inline");

and

element.setAttribute("style", "none");

but i'm thinking about using:

element.appendChild(childRef);

and

element.removeChild(childRef);

So, which one is the best solution in terms of system speed and elegance of the code? (and of course, are there better solution?)

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about user-interface