I’m tryig to used the mask plugin for jquery so that I can format my textbox.
but it seems this function is not working. I already tested it in a non-WP page it is working
but not when in WP. anyidea?
function mask_script(){
wp_register_script('jquery.maskedinput', plugins_url('js/jquery.maskedinput.js', __FILE__ ));
wp_enqueue_script('jquery.maskedinput');
}
add_action('wp_enqueue_script', 'mask_script');
UPDATE
I made it worked,. see the changes
I hope this can help someone like me in the future 🙂
function mask_script()
{
wp_enqueue_script('jquery');
wp_register_script('maskedinput1',plugins_url('/js/jquery.maskedinput.js', __FILE__ ));
wp_enqueue_script('maskedinput1');
}
add_action('wp_enqueue_scripts', 'mask_script');
Try to add a slash before
js
:since
plugins_url
function return the absolute URL to your plugins directory without the trailing slash.