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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:33:33+00:00 2026-05-23T14:33:33+00:00

I am having dynamically creating remove label. All have same class but different Ids.

  • 0

I am having dynamically creating remove label. All have same class but different Ids. I want to get the id when I click a label. I used $(.class).click function but it didn’t work. I can’t use onclick function because $(this).attr('id') is not working in IE 8.

Please give me a solution.

Thanks.

  • 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-23T14:33:34+00:00Added an answer on May 23, 2026 at 2:33 pm

    .click doesn’t work on elements that are created later dynamically.
    therefore use .live()

    $('.class').live('click', function(){ alert(this.id); });
    

    Update:

    http://api.jquery.com/live/

    As of jQuery 1.7, the .live() method is deprecated. Use .on() to
    attach event handlers.

    The above example using .on()

    $('body').on('click','.class',function(){ alert(this.id); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to dynamically map JSON information into different objects. But I can't
I've asked this before, but sadly I'm still having issues and the issue wasn't
I am dynamically populating a winforms combo box by creating a list from a
Let's say I have a base class template MyBase: template <class T> class MyBase{
I am having a problem with dynamically loaded views not being able to attach
I am having a problem, I am trying to make a link for a
I am working on a Drag and Drop Editor that is creating items and
I'm using the Facebook API Graph (C# & ASP.NET) to try to dynamically post
I'm using ASP.NET MVC2 and C#, but this question applies to ASP.NET in general.
My project requires me to create a database object (a custom class) containing a

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.