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>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.