Advertisement
bongzilla

Untitled

Jul 8th, 2022
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function initPhoneMask(fieldId) {
  2.  
  3. $(fieldId).attr("maxlength", "14");
  4.  
  5. $.mask.definitions['9']='';
  6. $.mask.definitions['d']='[0-9]';
  7. $(fieldId).mask("+7 (ddd) ddd-dd-dd");
  8. $(fieldId).intlTelInput({
  9. utilsScript:'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.13/js/utils.min.js',
  10. defaultCountry: 'auto',
  11. autoHideDialCode:false,
  12. autoPlaceholder:"aggressive",
  13. placeholderNumberType:"MOBILE",
  14. preferredCountries:['ru','by', 'kz', 'am', 'kg'],
  15. separateDialCode:true,
  16. customPlaceholder:function(selectedCountryPlaceholder,selectedCountryData){
  17. return '+'+selectedCountryData.dialCode+' '+selectedCountryPlaceholder.replace(/[0-9]/g,'_');
  18. },
  19. });
  20. $(fieldId).on("close:countrydropdown",function(e,countryData){
  21. $(this).val('');
  22. $(this).mask($(this).attr('placeholder').replace(/[_]/g,'d'));
  23. });
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement