Make sure to check if the event related to the button click is not propagating to child elements as an icon tag (<i class="fa...
) inside the button for example, so this propagation can make you miss the button $(this).attr('data-X10')
and hit the icon tag.
<button data-x10="C5">
<i class="fa fa-check"></i> Text
</button>
$('button.toggleStatus').on('click', function (event) {
event.preventDefault();
event.stopPropagation();
$(event.currentTarget).attr('data-X10');
});