How to use JS or Jq to track the clicks on the link, which is in a certain class?

3d5f7f7494.jpg

I need to track link clicks for Google Analytics. The idea is that you can use onclick on the link, but in this case it is impossible, as there is a block of a constructor, which does not allow to modify it. I can only put in a hat for a script that will keep track of clicking on the link within a class.

Usually always found a solution using onclick but now stuck with this site Builder((((
March 23rd 20 at 19:16
1 answer
March 23rd 20 at 19:18
Solution
Class references either. But data elementu to cling can.
Example:
$('a[data-cke-saved-href="tel:+77771256606"]').on('click', function() { 
alert('clicked');
})


Or just href:
$('[href="tel:+77771256606"]').on('click', function() { 
alert('clicked');
})


Well, you can use the class of the parent element:
$('.btn_descr a').on('click', function() { 
alert('clicked');
})
All phones:

$('a[href^="tel:"]')... - joe.Schroeder commented on March 23rd 20 at 19:21

Find more questions by tags jQueryJavaScript