We have a button that can only be clicked if a field is not empty. The user is not able to click on the button after filling in the field as the button is not clickable until the user clicks on something else.
I would advice against doing this.
It is poor usability and accessibility to disable and hide buttons in this way.
It is better to keep the button active and inform the user with an error message if they attempt to click it before completing a prerequisite action.