JS not working when making a WordPress theme from an HTML template

Solution:

Your JavaScript and CSS files should not go in the Media Uploader, they should be included in your theme. From there, you can enqueue them to be included in your header using wp_enqueue_script – http://codex.wordpress.org/Function_Reference/wp_enqueue_script – and wp_enqueue_style – http://codex.wordpress.org/Function_Reference/wp_enqueue_style.

The proper way to determine the page is to use the get_template_directory_uri() function.

For example if you want to register /wp-content/themes/YOUR_THEME/js/script.js and it relies on jQuery you would use this in your theme’s functions.php:

wp_enqueue_script('script_name', get_template_directory_uri()."/js/script.js" ,'jquery',false,true);