Really difficult to say without fully knowing what the code is trying to accomplish.
For starters, I’d be storing
$(this) as a variable just inside the click function like this:
var button = $(this);
…and then going:
Depending on what you’re trying to do you might want to look into using a