Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7367857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:35:25+00:00 2026-05-29T03:35:25+00:00

And why is .on() now preferred in jQuery 1.7?

  • 0

And why is .on() now preferred in jQuery 1.7?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:35:25+00:00Added an answer on May 29, 2026 at 3:35 am

    .on() now offers a combination of .live(), .delegate() and .bind() all in one unified method. You can get the behavior of any of those three just by how you use the arguments to .on().

    These pairs are functionally the same:

    // events bound directly to the object they occur on
    $('.button').on('click', fn);
    $('.button').bind('click', fn);
    
    // events intercepted after bubbling up to a common parent object
    $('.container').on("click", '.button', fn);
    $('.container').delegate('.button', "click", fn);
    

    More info is described in a jQuery blog entry.

    Before unifying these separate functions, jQuery had multiple different implementations. Now, .on() is the superset function and .bind(), .live() and .delegate() all just call .on() in their implementation so there is now only one implementation of the actual event handling. So, from that standpoint, it was also a code cleanup and streamlining issue. Similarly, .die(), .undelegate() and .unbind() just call .off() now rather than have separate implementations.

    Note: .live() has been deprecated for all versions of jQuery because it’s just a special case of intercepting all the bubbled events on the document object so it can be easily replaced with either .delegate() or .on() and when lots of events were all being handled on the document object, it could become a performance problem checking lots of selectors on every event. It’s much more efficient to hook a delegated event like this to a common parent that is much closer to where the event occurs than put them all on the document object (thus why .live() is not good to use).

    From the jQuery 1.7 source, you can see how all these functions just now call .on() and .off():

    bind: function( types, data, fn ) {
        return this.on( types, null, data, fn );
    },
    unbind: function( types, fn ) {
        return this.off( types, null, fn );
    },
    
    live: function( types, data, fn ) {
        jQuery( this.context ).on( types, this.selector, data, fn );
        return this;
    },
    die: function( types, fn ) {
        jQuery( this.context ).off( types, this.selector || "**", fn );
        return this;
    },
    
    delegate: function( selector, types, data, fn ) {
        return this.on( types, selector, data, fn );
    },
    undelegate: function( selector, types, fn ) {
        // ( namespace ) or ( selector, types [, fn] )
        return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I actually have right now two questions: 1) What font faces are preferred for
I have been using jQuery lately, but never used JSON with it. Now, I
I've been writing Perl for several years now and it is my preferred language
Now that most of the major browsers support full page zoom (at present, the
Now that I know C++ I want to get into desktop application that have
Now that LINQ to SQL is a little more mature, I'd like to know
Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now
now i need to insert some data from the sqlserver into a word,i know
Now, before you say it: I did Google and my hbm.xml file is an
Now that it's clear what a metaclass is , there is an associated concept

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.