JavaScript style.display="none" or jQuery .hide() is more efficient?

css, javascript, jquery, performance

Solution

Talking about efficiency:

document.getElementById( 'elemtId' ).style.display = 'none';

What jQuery does with its `.show()` and `.hide()` methods is, that it remembers the last state of an element. That can come in handy sometimes, but since you asked about efficiency that doesn't matter here.

Problem

``` document.getElementById("elementId").style.display="none" ``` is used in JavaScript to hide an element. But in jQuery, ``` $("#elementId").hide(); ``` is used for the same purpose. Which way is more efficient? I have seen a comparison between two jQuery function `.hide()` and `.css("display","none")` here. But my problem is whether pure JavaScript is more efficient than jQuery?

Original source

Related problems