I have a problem with my scripts on Wordpress.
I have enqueued scripts in my functions.php file:
function pg_theme_js() {
wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '', false);
wp_enqueue_script( 'typeit_js', get_template_directory_uri() . 'https://cdn.jsdelivr.net/jquery.typeit/4.3.0/typeit.min.js', array('jquery'), '', false);
wp_enqueue_script( 'functions_js', get_template_directory_uri() . '/js/functions.js', array('jquery'), '', false);
wp_enqueue_script( 'smoothscroll_js', get_template_directory_uri() . '/js/smoothscroll.js', array('jquery', '', false));
wp_enqueue_script( 'prefix_js', get_template_directory_uri() . 'https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js', array('jquery'), '', false);
}
add_action( 'wp_enqueue_scripts', 'pg_theme_js' );
My TypeIt javascript code looks like this:
$('#typing-code').typeIt({
strings: [
'<div class="container">',
],
speed: 40,
autoStart: false,
startDelay: 50,
breakDelay: 50
});
And all my .js files are wrapped in this:
jQuery(document).ready(function($) {
//code
});
The problem seems to arise at the typeIt snippet and causes all the following code that comes after it to break too.
Any help would be very much appreciated!
I figured it out. For reference if anyone needs help in the future:
For the enqueued scripts in functions.php, remove 'get_template_directory_uri()' for the scripts with a complete URL.