Cannot get custom javascript to execute on page

I have a simple piece of “hello world” code I’m trying to execute on a page. I’m adding it using a PHP snippet:

I can get it to show up in the page source and if I paste that directly into the console it works fine, however when I load the page and try it, I get nothing. I know that jQuery is loading because it is defined in the console without my intervention (previously this was not the case), however the code itself appears to not work at all.