I’m trying to hide the contact form after it passes validation and is submitted. I want to do this with a simple custom JavaScript function.

The thing is, the console keeps informing me that my JS function is undefined. At first I had thought that this might be happening because I’m not enqueing the *.js correctly, but that’s not the case – my custom.js is clearly visible in the page’s source code, and its contents match what I’d put inside.