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 8307479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:31:56+00:00 2026-06-08T18:31:56+00:00

I am having trouble using the .on method in jQuery on content that has

  • 0

I am having trouble using the “.on” method in jQuery on content that has been inserted via AJAX. I currently use “.live”, however this is deprecated and “.on” is what I’m after.

My working code is:

$('.folderadmin').live("click", function() 
{   
   // Do stuff
})  

When I replace the .live with .on, it fails to work. I believe it is because the element .folderadmin is loaded via AJAX – thus why we needed to use .live to access it. How can I access the DOM and recognize .folderadmin with .on?

  • 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-08T18:31:56+00:00Added an answer on June 8, 2026 at 6:31 pm
    $('.folderadmin').live("click", function() {   
       // Do stuff
    });
    

    is same as

    $(document).on("click", '.folderadmin', function() {
      // Do stuff
    });
    

    But it is not necessary to bind to document, you could bind to the parents container of .folderadmin which has already exists in the dom tree.

    $('#the_parent_id').on("click", '.folderadmin', function() {
      // Do stuff
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble using jQuery.ajax() to post a gist to Github. The gist is
I'm new to jQuery and having some trouble. A have a page that has
I am having trouble using the Add method for an ObservableCollection to simply add
I am having trouble constructing a jqGrid TreeGrid using local data. This method works
Anybody having trouble using AVFoundation with GC ON??? What I am experiencing is that
I'm having a little trouble using jQuery in Rails. I'd like to call the
I am having trouble using nested ajax calls with selectors. I have a section
I'm using jQuery 1.3.2. I'm having trouble getting a correct height in Internet Explorer
Having trouble getting a form using PHP, JQuery Form plugin, and JQuery Validate plugin
I am having trouble using the cin method to acquire a variable. When the

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.