Hi Tym,
Have you seen the javascript button? From the documentation “A Mendix button widget that can run custom JavaScript. You can even run a microflow before or after the JavaScript.” There is a setting to enable jquery, you could try using this instead of the html snippet to bind the script to your button.
https://appstore.home.mendix.com/link/app/27064/Mendix/JavaScript-Button
Edit: You can try this for your hello world
https://www.w3schools.com/js/js_popup.asp
To query an element I usually use classes since the IDs are dynamic. You can try hasClass
https://api.jquery.com/hasclass/