jQuery On vs Click

JavaScript performance comparison

Revision 2 of this test case created by DJI

Preparation code

<div id="Container">
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1">link</span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1"><input type="button" value="Button 1" class="input1" id="input1"></span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1"><input type="button" value="Button 2" class="input1" id="input2"></span></a>
  </div>
  <div class="d1">
    <a class="a1" href="#"><span class="s1"><input type="button" value="Button 3" class="input1" id="input3"></span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2">link2</span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2"><input type="button" value="Button 4" class="input2" id="input4"></span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2"><input type="button" value="Button 5" class="input2" id="input5"></span></a>
  </div>
  <div class="d2">
    <a class="a2" href="#"><span class="s2"><input type="button" value="Button 6" class="input2" id="input6"></span></a>
  </div>
  <input type="button" value="Button 7" class="input1" id="input7">
  <input type="button" value="Button 8" class="input2" id="input8">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
    

Preparation code output

<div id="Container"> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1">link</span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1"><input type="button" value="Button 1" class="input1" id="input1"></span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1"><input type="button" value="Button 2" class="input1" id="input2"></span></a> </div> <div class="d1"> <a class="a1" href="#"><span class="s1"><input type="button" value="Button 3" class="input1" id="input3"></span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2">link2</span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2"><input type="button" value="Button 4" class="input2" id="input4"></span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2"><input type="button" value="Button 5" class="input2" id="input5"></span></a> </div> <div class="d2"> <a class="a2" href="#"><span class="s2"><input type="button" value="Button 6" class="input2" id="input6"></span></a> </div> <input type="button" value="Button 7" class="input1" id="input7"> <input type="button" value="Button 8" class="input2" id="input8"> </div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
click #id
$('#input1').click(function() {
  alert('hello');
});
pending…
on #id
$('#input1').on('click', function() {
  alert('hello');
});
pending…
click .class
$('.input1').click(function() {
  alert('hello');
});
pending…
on .class
$('.input1').on('click', function() {
  alert('hello');
});
pending…
on. #id.class
$('#Container').on('click', '.input1', function() {
  alert('hello');
});
pending…
on #id with live
$('#input1').live('click' ,function() {
  alert('hello');
});
pending…

Compare results of other browsers

Revisions

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

0 Comments

link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2
link2