I am trying to load a js file on a page, I've included
function formScriptLoad() {
wp_enqueue_script( 'formScript', get_template_directory_uri() . 'https://tmsact.com.au/wp-content/themes/hello-elementor/assets/js/formScript.js');
}
add_action('wp_enqueue_scripts','formScriptLoad');
in the functions.php of the theme I'm using and I checked that header.php and footer.php have a wp_head() and wp_footer() included. Any idea what I might be missing? Thanks!
EDIT: when I paste the script directly on the page using < script > in a HTML embed it works briefly then stops on refresh.
wp_enqueue_script( 'formScript', get_template_directory_uri() . '/assets/js/formScript.js');
– MattHamer5