Here is my HTML structure:
<tr>
<td class="option_name_twitter">Something</td>
<td class="option_loading">
<img src="img/checked_successfully.png">
</td>
</tr>
<tr>
<td class="option_name_instagram">Something else</td>
<td class="option_loading">
<img src="img/checked_successfully.png">
</td>
</tr>
And here is my code:
$(document).on('click', "img[src$='checked_successfully.png']", function () {
var name = $(this).closest('td.option_loading').sibilings('td.^option_name_').attr('class');
})
I'm trying to get the last part of the classname's value of an element that starts with option_name_. So the expected result is either twitter or instagram. How can I do that?