How do I select a class element based on its id in jQuery?
- by Michael
I have multiple dynamically generated buttons with a class name of ".button". Each of these are given an unknown ID value used to uniquely identify them. In jQuery I must select one and alert the values.
<div class="button" id="3"></div>
The ID value is dynamically generated, therefore I do not know it. I'm new to jQuery but am basically looking for something like this:
$(".button").attr("id").val();
How do I target one button when there are many? Thanks!