Last active
April 4, 2024 07:52
-
-
Save UraraReika/e21e8018bfe90a20384810f082bee600 to your computer and use it in GitHub Desktop.
Enqueue International Telephone Input scripts and styles and initialise it on your input element.
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
<php add_action( 'wp_enqueue_scripts', function() { | |
wp_enqueue_style( 'int-tel-input-style', 'https://cdn.jsdelivr.net/npm/[email protected]/build/css/intlTelInput.css' ); | |
wp_enqueue_script( 'int-tel-input-script', 'https://cdn.jsdelivr.net/npm/[email protected]/build/js/intlTelInput.min.js', [], '20.3.0', true ); | |
} ); |
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
if ( document.querySelector('#contact_form') ) { | |
window.intlTelInput( document.querySelector('__your_selector input'), { // Example - #contact_form .elementor-field-type-tel | |
initialCountry: 'us', | |
showSelectedDialCode: true | |
} ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment