Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .wrap
	h1 Input tel number - intl-tel-input (show results in console)
	//- ... BEGIN
	//- ... END
	form(action="#", method="get")
		.form-group
			input.form-control(type='tel', class='tel', name='leyka_donor_phone', inputmode='tel', value='')
		.form-group
			input.btn.btn-default(type="subimit" value="Отправить")

              
            
!

CSS

              
                $default-font: 'Open Sans', sans-serif

$accent: #ffb74d
$link: #4a90e2
$link_hover: darken($link, 10%)
$accent_hover: darken($accent, 10%)

$text_color: #2f3640
$gray: #edeff0
$dark_gray: #b5bac1
$light_gray: #E5E5E5

@function rem($px)
	@return $px / 16px + 0rem
	@return $px

@mixin inline-block($va: top)
	display: inline-block
	vertical-align: $va

html
	font-size: 16px
	background: $gray
	font-family: $default-font
	height: 100%

body
	height: 100%
	display: flex
	background-color: $gray

h1
	font-size: 20px
	margin-bottom: 20px

.wrap
	width: 500px
	margin: auto
	border-radius: 4px
	background-color: #ffffff
	box-shadow: 0 1px 2px 0 #c9ced1
	padding: rem(20px)


.iti
	width: 100%
              
            
!

JS

              
                $(function () {


        /*
         * International Telephone Input v16.0.0
         * https://github.com/jackocnr/intl-tel-input.git
         * Licensed under the MIT license
        */
        var input = document.querySelectorAll("input[name=leyka_donor_phone]");
        var iti_el = $('.iti.iti--allow-dropdown.iti--separate-dial-code');
        if(iti_el.length){
            iti.destroy();
			
			// Get the current number in the given format

			

        }
       for(var i = 0; i < input.length; i++){
            iti = intlTelInput(input[i], {
                autoHideDialCode: false,
                autoPlaceholder: "aggressive" ,
                initialCountry: "auto",
                separateDialCode: true,
                preferredCountries: ['ru','th'],
                customPlaceholder:function(selectedCountryPlaceholder,selectedCountryData){
                    return ''+selectedCountryPlaceholder.replace(/[0-9]/g,'X');
                },
                geoIpLookup: function(callback) {
                    $.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
                      var countryCode = (resp && resp.country) ? resp.country : "";
                      callback(countryCode);
                  });
                },
                utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/16.0.0/js/utils.js" // just for 
        });

		   
        $('input[name="leyka_donor_phone"]').on("focus click countrychange", function(e, countryData) {

            var pl = $(this).attr('placeholder') + '';
            var res = pl.replace( /X/g ,'9');
            if(res != 'undefined'){
                $(this).inputmask(res, {placeholder: "X", clearMaskOnLostFocus: true});
            }
			
			


        });
		   
		   $('input[name="leyka_donor_phone"]').on("focusout", function(e, countryData) {
			   var intlNumber = iti.getNumber();
			   console.log(intlNumber);   
		   });
		   
    }


})
              
            
!
999px

Console