Does anybody know how to best implement this script http://jackocnr.com/intl-tel-input.html
in Enfold – or does anybody have another idea to use phone prefix?
Hey Knut!
That’s pretty cool, thanks for sharing.
I didn’t test it out but perhaps something like this in the bottom of your functions.php file would work.
add_action( 'wp_footer', 'enfold_customization_phone_form' );
function enfold_customization_phone_form() {
?>
<script type = "text/javascript" src = "URL to the script"></script>
<script type = "text/javascript">
jQuery(document).ready(function(){
jQuery("#avia_phone_1").attr("type", "tel").intlTelInput();
});
</script>
<?php
}
You would need to add a text input to your form and then set the label to just “Phone”. You would also need to download the script and link to it correctly on this line.
<script type = "text/javascript" src = "URL to the script"></script>
Best regards,
Elliott
Goodie and thanks
What if you want to use this in a regukar input field -> save to database anybody knowa the best practice for this?
Hi!
You could use this jQuery to target a specific element.
jQuery("#ID_of_your_element").intlTelInput();
You can see the documentation in the link you provided.
Regards,
Elliott