jQuery masked input plugin conflicts with jQuery Tools (at least with overlay)

5.5k Views Asked by At

I found that jQuery masked input plugin (http://digitalbush.com/projects/masked-input-plugin/) conflicts with jQuery Tools overlay methods load() and close(). So, when you import jQuery Tools first and then after jQuery masked input plugin and try to run:

$("#overlay").overlay().load()

the following error occurs:

TypeError: b.mask.load is not a function ...jquery.tools.min.js:87 (on Firefox)

and

Uncaught TypeError: Object #<Object> has no method 'load'  ...jquery.tools.min.js:87 (on Chrome)

And another way round: if you import jQuery masked input plugin first and then jQuery Tools, now overlay works, but jQuery masked input plugin doesn't.

Does anybody know another alternative for jQuery masked input plugin which works nicely with jQuery Tools?

Or maybe this issue can be fixed somehow?

2

There are 2 best solutions below

0
On BEST ANSWER

I've forked the project and created the pull request: https://github.com/digitalBush/jquery.maskedinput/issues/94.

Thanks FagnerMartinsBrack for his help: https://github.com/digitalBush/jquery.maskedinput/issues/94.

1
On

I am not sure if this is gonna work but u could try to mess with jQuery.noConflict() to avoid changing the original mask namespace

Maybe something like:

//not tested
var $jMask = jQuery.noConflict();
$jMask.mask("99.99.99.99");

And use jquery tools with the regular $