OnClick with URLs on Mobile

Hello,
If I create a hyperlinked button with an ‘onclick’ code to hide that button after it has been clicked, it hides on desktop sites, but not mobile. I believe this is likely due to variations between how each click is handled between platforms, but I can’t seem to remedy the issue.
Has anybody had similar issues with any fixes?