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!
I think I found your error, though it’s outside the scope of your problem. The point is, the
thisis 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:
[Edit]
You can btw also do this:
$('#div_id a').live('click', blabla). Thethis-object will then be the actual button.