Skip to content
Advertisement

How to make this code work with .each function?

I have the following piece of code in a script tag that I need to get working for all #tel ID elements on the page. I can only get it to work for the first #tel element. I’ve been trying to use .each function – but no luck…

The reason being is that I can’t seem to get the ACF repeater URL to suit my needs here. The Advanced section of the dynamic content link part is not displaying. So I am trying to make a hack in an HTML widget for this. But I need it to work for all buttons with button ID #tel.

Here’s the code:

JavaScript
JavaScript

Advertisement

Answer

In HTML/javascript element IDs must be unique. So in your case you can use class for that:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement