Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #369026

    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?

    #369098

    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

    #369952

    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?

    #370231

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.