Hi,
On the click of the button, set a flag to True and immediately after setting a flag. Call refresh ribbon as in the below link.
http://mscrmtechie.blogspot.com/2015/09/refresh-ribbon-using-javascript-in-crm.html
Write a Custom JavaScript Display rule, which checks check the flag value and returns True or False so that the custom will be shown/hidden.
Follow the below link to get more on the enable rules.
http://mscrmtechie.blogspot.com/2015/09/show-or-hide-add-new-or-button-on-form.html
The logic is very simple, when we refresh the ribbon the Display/Enable rules are executed again. So Our button gets hidden as we set the flag on the click of the button which the previous operation performed on the button click.
Gopinath
My blog