I'm trying to enqueue a JS file (located at /js/example-script.js), just to get an alert on page load.
Can anyone tell me what I'm doing wrong?
In my example-script.js:
jQuery(document).ready(function($) {
alert("hi");
});
And in my functions file:
function my_theme_scripts() {
wp_enqueue_script( 'example-script', get_template_directory_uri() . '/js/example-script.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'my_theme_scripts' );
jQuery is loaded in my sources, so that's not the problem...
example-script
handler name