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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:51:41+00:00 2026-05-29T17:51:41+00:00

I have this sort of a link: <a class=image_button data-problem_id=157 style=display: inline; href=#><span>See Solutions

  • 0

I have this sort of a link:

<a class="image_button" data-problem_id="157"  style="display: inline;" href="#"><span>See Solutions Members Have Already Suggested</span></a>

and then I try to get the id like this:

var problem_id = $(this).attr("data-problem_id");

but it ends up being undefined. Any idea why? In other cases I did what seems to be exactly this, and I was able to get the problem_id

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-29T17:51:57+00:00Added an answer on May 29, 2026 at 5:51 pm

    I think I found your error, though it’s outside the scope of your problem. The point is, the this is a div, and not your button. How you change this you need to see for yourself. You can either reassign the click (instead of $("#div_id").live('click', blabla); do $("#button_id").live('click', blabla);, or you can run the check on the click target.

    This would look something like:

    $('#div_id').live('click', function(evt) {
        var btn = $(evt.target).closest('a');
        var data_thingy = btn.data('data_thingy');
    });
    

    [Edit]
    You can btw also do this: $('#div_id a').live('click', blabla). The this-object will then be the actual button.

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

Sidebar

Related Questions

I have this big data-entry sort of page, a table kind of layout using
I have this problem that always occurs when I'm using display: inline-block to display
I have a vertical image gallery of this sort: <div class=image-container> <div class=nav> <div
I have this markup: <asp:Repeater ID=appsRepeater runat=server> <ItemTemplate> <li> <div class=clearfix> <a href=---some code
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
for (;;) { //Something to be done repeatedly } I have seen this sort
I'm doing a bit of coding, where I have to write this sort of
I have read over this which sort of gives an explanation of when you'd
I have a section of makefile that has this sort of structure: bob: ifdef
Does anyone have any experience with this sort of thing? I'm talking about applets

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.