jQuery click vs bind vs on (v8)

Revision 8 of this benchmark created on


Description

Tests performance of jQuery event listeners.

Preparation HTML

<script src="//code.jquery.com/jquery-1.7.2.js"></script>
<div id="main"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
click
$("#main").click(function(){});
ready
bind
$("#main").bind("click", function(){});
ready
on
$("#main").on("click", function(){});
ready
onclick
document.getElementById("main").onclick = function() {};
ready
live
$("#main").live("click", function(){});
ready

Revisions

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