Q:

Is there a way to get an applied input mask from an element?

I'm trying to get the input mask that was applied to different elements using Josh Bush's Masked Input Plugin (https://github.com/digitalBush/jquery.maskedinput) so that I can re-apply them to cloned elements.
Any ideas?
Thank you!

A:

I ended up patching the maskedInput function to add the applied mask in a data attribute attached to the input element like this:
function patchMask() {
    var plugin = jQuery.fn.mask;
    jQuery.fn.mask = function(mask) {
        jQuery(this.get(0)).attr('data-mask', mask);
        return plugin.apply(this, arguments);
    };
}

jsFiddle here: http://jsfiddle.net/kodie/kvbn20t8/6/

