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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:43:19+00:00 2026-05-23T21:43:19+00:00

So I am binding a .click() function to a css class, but I want

  • 0

So I am binding a .click() function to a css class, but I want to be able to access the calling element’s id from inside this function when it is called. What is the best way to do this?

  • 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-23T21:43:20+00:00Added an answer on May 23, 2026 at 9:43 pm

    You can pull it right out of this:

    $(selector).click(function() {
        var id = this.id;
        // Do interesting things.
    });
    

    The this in a jQuery click callback is just a DOM object that exposes its attributes as object properties.

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

Sidebar

Related Questions

I have a click event handler that looks like this: $('#show_existing_suggestions').click(function() But after some
In jquery an event hadler's binding is the event generating DOM element (this points
JavaScript's late binding is great. But how do I early bind when I want
Hey, I'm desperate right here. jQuery: $(.rotateme li a).click(function(){ var curid = $(this).attr('id'); $('#box'+curid).fadeIn('slow');
I am binding the click event to 4 href's (they have class=alink) using JQuery
How can I change the click binding of an element? Html snippet is: <div
I have this jQuery click event $('#sidebar .nav a span').click(function () { var sidebar_nav
I've got the following in my <head> section: <script type=text/javascript> $(function(){ $(h5).live(click, function(){ alert($(this).tmplItem());
Inside of an onclick event, I'm binding another onclick event. But when I initiate
Check out this jsfiddle . There is a <div> with a click binding. This

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.