1

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');
1

1 Answer 1

0

Try to add a slash before js:

wp_register_script('jquery.maskedinput', plugins_url('/js/jquery.maskedinput.js', __FILE__ )); 
----------------------------------------------------- ^ here -----------------

since plugins_url function return the absolute URL to your plugins directory without the trailing slash.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.