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

  • Home
  • SEARCH
  • 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 8865165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:26:08+00:00 2026-06-14T16:26:08+00:00

I understand that the live function is now deprecated. How can I migrate the

  • 0

I understand that the “live” function is now deprecated. How can I migrate the following to make use of the new “on”?

$('a.action').live( "click", function (evt) {

        // Do stuff 

}

The scenario is that the a.action is being created on the fly. I’ve tried this, to no avail:

$('a.action').on( "click", function (evt) {

        // Do stuff 

}
  • 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-06-14T16:26:09+00:00Added an answer on June 14, 2026 at 4:26 pm

    If you want the actual .live() – type performance where a.action objects don’t have to exist yet when you add the event handler, then you should find a parent DOM object of all a.action elementss that always exists and bind .on() to that like this:

    $(parent selector).on('click', 'a.action', function (evt) {
        // Do stuff
    });
    

    That parent should be as close to the a.action objects as possible for maximum efficiency. For that reason, it is NOT desirable to bind to document.

    In fact, one reason .live() has been deprecated is because it was bound to the document object and could easily lead to performance problems when there were too many events all flowing through the one object (event dispatching performance suffered).

    See these other related answers of mine for more info:

    jQuery .live() vs .on() method for adding a click event after loading dynamic html

    How does jQuery's new on() method compare to the live() method in performance?

    Should all jquery events be bound to $(document)?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that within same folder, I can use include() function for external PHP
I understand that applications under the same domain name can talk to each other
I understand that we can set the various style attributes from code behind using
I have the .live aspect working now so if links are clicked, my function
I'm trying to build a jQuery.live like function. Helper is a class that has
Okey so I got a really wierd problem that I can't understand. i got
In C# I understand that static variables are created in memory and live as
I understand that: '\n' // literally the backslash character followed by the character for
I understand that JVM and CLR were designed as stack-based virtual machines. When JIT
I understand that the em measurement is a relative unit for font-size, relative to

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.