Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active September 6, 2016 08:54
Show Gist options
  • Save max-kk/85ae495a82e43403c7f4359441eb317b to your computer and use it in GitHub Desktop.
Save max-kk/85ae495a82e43403c7f4359441eb317b to your computer and use it in GitHub Desktop.
maskedinput_async
jQuery.cachedScript = function( url, options ) {
// Allow user to set any option except for dataType, cache, and url
options = $.extend( options || {}, {
dataType: "script",
cache: true,
url: url
});
// Use $.ajax() since it is more flexible than $.getScript
// Return the jqXHR object so we can chain callbacks
return jQuery.ajax( options );
};
jQuery.cachedScript("//cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.jss").done(function() {
$("input[name='phone']").mask("38 (099) 999-99-99");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment