I registered my Javascript file in my plugin, but the functions of click
and so on. do not work.
I registered my main plugin file with action
:
function add_scripts_to_plugin()
{
wp_enqueue_script( 'birthdate_celebrate_js', dirname(__FILE__) . '/includes/assets/js/main.js', array( 'jquery' ));
}
add_action('wp_enqueue_scripts', 'add_scripts_to_plugin');
The Javascript file:
jQuery( function( $ ) {
$('#birthdate_celebrate_send_mails').on('click', function () {
console.log('clicked');
});
});
The plugin loads normally and does not display any errors in the console or in PHP, but even then the eventListener
of click is not added to the button.