jaridmargolin / formatter.js

Format html inputs to match a specified pattern
http://firstopinion.github.io/formatter.js
2.48k stars 235 forks source link

use jQuery instead of $ #63

Open jakobg opened 10 years ago

jakobg commented 10 years ago

Hi there,

in the jQuery version you should use "jQuery" instead of its short version "$". the short version could be overwritten by other libraries.

Thanks,

Jakob

caiorg commented 10 years ago

To prevent this behaviour, you could use encapsulation.

Like this:

(function($) {
    $(function(){ //shorthand for $(document).ready(function(){});
        // do your magic here
    });
)(jQuery);
jaridmargolin commented 10 years ago

Thank you for brining this to my attention. The UMD wrapper used in the jquery version should actually be able to handle this. Unfortunately it is referencing jQuery rather than $. Change should not be horribly difficult.

https://github.com/firstopinion/formatter.js/blob/master/src/tmpls/jquery.hbs#L20 https://github.com/firstopinion/formatter.js/blob/master/dist/jquery.formatter.js#L29