onclick div

Benchmark created by onclick div on


Preparation HTML

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

<div id="id_div"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
test1 : store in var
$(function() {

  var div = $('#id_div').click(function() {
    div.fadeOut('slow');
  });

});
ready
test2 : use "this" context
$(function() {

  $('#id_div').on("click", function() {
    $(this).fadeOut('slow');
  });

});
ready

Revisions

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

  • Revision 1: published by onclick div on