Created
February 3, 2026 21:48
-
-
Save mohsinworld/bb90aecc84cce7965f4534d66a83cc46 to your computer and use it in GitHub Desktop.
Canda & USA is the default country. "number" should be the number field's ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTML widget 1: | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.5.0/css/intlTelInput.css"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.5.0/js/intlTelInput.min.js"></script> | |
| HTML widget 2: | |
| <script> | |
| jQuery(window).on('elementor/frontend/init', function () { | |
| elementorFrontend.hooks.addAction( | |
| 'frontend/element_ready/form.default', | |
| function ($scope) { | |
| if (typeof window.intlTelInput === 'undefined') return; | |
| const phoneInput = $scope.find('#form-field-number')[0]; | |
| if (!phoneInput) return; | |
| if (phoneInput.classList.contains('iti-initialized')) return; | |
| window.intlTelInput(phoneInput, { | |
| initialCountry: 'ca', | |
| separateDialCode: true, | |
| preferredCountries: ['ca', 'us'] | |
| }); | |
| phoneInput.classList.add('iti-initialized'); | |
| } | |
| ); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment