.bind() vs .live() vs .delegate() vs .on() (v16)

Revision 16 of this benchmark created on


Description

The Difference Between jQuery’s .bind(), .live(), and .delegate()

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
function handler() {
        $('p').text("CLICK !");
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.bind (deprecated)
$('p').bind('click', handler);
ready
.delegate (deprecated)
$(document).delegate('p', 'click', handler);
ready
.on (bind syntax)
$('p').on('click', handler);
ready
.on (delegate syntax)
$(document).on('click', 'p', handler);
ready

Revisions

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