Two things need to happen:
Do they both not work, or just (part of) one of them?
*Edited*
The html-snippet, added to any part of a page, having this settings, should trigger the alert ‘hi’ on page-load, and trigger the script to show or hide your button:
Hi Swamy Nandikam,
Can you please refer this link which will helps you definitely in addition I think