Support

Account

Home Forums Backend Issues (wp-admin) Phone field with href="tel:" link Reply To: Phone field with href="tel:" link

  • Hi @brevalo, in Elementor, for the button select Advance and give the button a CSS name like phoneButton. That’s what I did for all the phone buttons on my page. Then I added the script above to Elementor / Custom Code and applied it every page.

    What error are you getting? Be careful with the quotes within the code when you copy and paste. Sometimes they get screwed up and can cause an error. You should retype the quotes within the function just to make sure. Here is my code again that is working for me.

    <script>
    (function($){
    $(“.phoneButton a”).attr(“href”, function ( index, currentvalue) {
    var url_format = currentvalue.replace(/(^\w+:|^)\/\//, “”);
    $(this).attr(“href”, “tel:” + url_format);
    });

    })(jQuery);
    </script>