Hide versus Toggle

JavaScript performance comparison

Test case created

Info

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

       <div id = "loginSignUpBox">
            <div id = "loginBox" class ="loginBox">
                <ul>
                    <li><a href= " " >Login</a></li>
                    <li><a href= " " >Sign Up</a></li>
                </ul>
            </div>
        </div>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Toggle
$(document).ready(function(){
    $('div.loginBox:visible').toggle();
});
pending…
Hide
$(document).ready(function(){
    $('div.loginBox').hide();
});
pending…
Toggle without :visible
$(document).ready(function(){
    $('div.loginBox').toggle();
});
pending…
Hide with id
$(document).ready(function(){
    $('#loginBox').hide();
});
pending…

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

Compare results of other browsers

0 comments

Add a comment