I have a button on my page with a class of comment_like and an ID like comment_like_123456 but the numbers at the end are variable; could be 1 to 1000000.
When this button is clicked, I need to grab the end number so I can run tasks on other elements with the same suffix.
Is there an easy way of grabbing this number in jQuery?
$('.comment_like').click(function() {
var element_id = $(this).attr('id');
// grab number from element ID
// do stuff with that number
});
You can get it like this:
With respect to button: