Link to home
Start Free TrialLog in
Avatar of egoselfaxis
egoselfaxis

asked on

Including currency Input mask jquery plugin in custom WordPress plugin

I'm trying to implement this currency input mask functionality in my custom Wordpress plugin:

https://jsfiddle.net/theandybob/t37m0txu/

I see that it requires the "jquery.inputmask.bundle.js" external resource (which I presume is a JQuery plugin) ... though I can't seem to figure out how to incorporate a reference to it in my plugin.  

Ideally, I'd prefer to load the plugin from a CDN.  How would I go about doing that?  I have the following section in my plugin .. and I just need some help figuring out how to update it so that it loads the plugin from the CDN:

function load_custom_scripts() {      
    if ( ! wp_script_is( 'my-jquery-ui', 'enqueued' )) {	  
	  	wp_enqueue_style( 'my-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/humanity/jquery-ui.css',false,'1.11.4','all');	  
	  	wp_register_script('my-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'); 
               wp_enqueue_script( 'my-jquery-ui' );
    }
}
add_action( 'admin_enqueue_scripts', 'load_custom_scripts' );

Open in new window


Any help would be appreciated.

Thanks,
- Yvan
Avatar of HainKurt
HainKurt
Flag of Canada image

just add

wp_register_script('my-jquery-ui', 'https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js'); 

Open in new window


after line 4
Avatar of egoselfaxis
egoselfaxis

ASKER

I already tried that and it isn't working.  

I know that because I'm getting a javascript error, ... and when I view the underlying source code and do a "find in page" .. I see no reference to "jquery.inputmask.bundle.js" at all whatsoever.  

- Yvan
ASKER CERTIFIED SOLUTION
Avatar of egoselfaxis
egoselfaxis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I figured it out on my own.