I made a template called test-stuff.php and tried using jQuery and the jQuery validation plugin in it. I've enqueued the scripts in my functions.php file and the jQuery works fine on other regular pages, but not in my template. Could someone point out where I went wrong? Do I have to enqueue jquery and the jquery plugin separetely for the template? If I have left out some details, please ask and I will provide. Thanks in advance.
functions.php enqueuing part:
function my_custom_queue() {
wp_enqueue_script('jquery');
wp_enqueue_script( 'validatejq', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js', array( 'jquery' ), '1' );
}
add_action( 'wp_enqueue_scripts', 'my_custom_queue' );
Template file with jquery testing function(I get "no"):
<?php
/* Template name: Test stuff */
?>
<script>
window.onload = function() {
/* test */
if (window.jQuery) {
alert("Yes");
} else {
alert("No");
}
};
</script>