I have a javascript file with the following code (for test):
I try to include this file in my form, but the alert doesn't show up. I tried enqueuing the file as follows:
but that doesn't work. I also tried adding a
<script>
tag to the top of my page template (I'm using a special page template for my form):
but that doesn't work either. What am I doing wrong?
The funny thing is that in both cases, the alert doesn't show up on the first time I load the form (the form is loaded via thickbox), but on the following times the alert does work