I am struggling a lot this time working on including a JavaScript files in plugin folder.
I am trying to create a plugin by transferring widget files from themes directory. I copied the widget file, but that widget file was depending on a JavaScript file so I created a /js/ folder in plugin directory. where this files is hosted "jquery.repeatable.js"
I used this code, but it doesn't seems to include the js file -
function Zumper_widget_enqueue_script()
{
wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'js/jquery.repeatable.js' );
}
add_action('admin_enqueue_scripts', 'Zumper_widget_enqueue_script');
I searched this on forum- https://stackoverflow.com/questions/31489615/call-a-js-file-from-a-plugin-directory
But still this was not helpful.
I am re-summarizing my question. In my plugin directory there is a js file under this folder - /js/
I wish to include it what is the correct process, do I need to register something also?
Is there something wrong with this portion - 'admin_enqueue_scripts'
?