Question about OnClick Event preventDefault

If you do not want a button to be functional under certain circumstances, you could hide the button or you could disable it.

Alternatively, have a look at creating a Flow for the on-click event:

and