I have looked over carefully at the scripts file for a WordPress plugin I am developing and I also looked at a similar post:
javascript file not working when linked from HTML
but the answer above has not worked either. I am not sure why the javascript file is not loading.
Here is the includes/newsletter-subscriber-scripts.php:
<?php
// Add Scripts
function ns_add_scripts(){
wp_enqueue_style('ns-main-style', plugins_url().'/newsletter-subscriber/css/style.css');
wp_enqueue_script('ns-main-script', plugins_url().'/newsletter-subscriber/js/main.js');
}
add_action('wp_enqueue_scripts', 'ns_add_scripts');
Here is the javascript file that is not loading in /newsletter-subscriber/js/main.js:
alert('Linked');