Hide with and without jQuery (v2)

Revision 2 of this benchmark created by Camwyn on


Description

Hiding an element without jQuery is faster than with jQuery and still only one line of code.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div>
  <div id="element">My Element</div>

</div>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery
jQuery( '#element' ).toggle();
ready
Non-jQuery
document.getElementById( 'element' ).style.display = 'none';
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Taylor Lovett on
  • Revision 2: published by Camwyn on
  • Revision 4: published by Vadim on