I am running into a problem with my output of an HTML-to-PDF process where my anchor tags that contain the tel: protocol are kicking back errors when clicked. It turns out that these hrefs are being seen as relative URLs unlike how mailto: is recognized as it's own thing.
I figure that if I can target these elements directly, I could take their content, hide the <a> tag entirely and only display the content in a new element. Maybe this is overthinking it?
Here's where I went: https://jsfiddle.net/BIPC_Sydor/yL8suwno/1/
I wanted to try and target each instance of an <a> tag within a specific div (class of menu). Then copy the content of each instance into a new <p> tag (class of pdf). From there I could hide the old <a> and stylize the new <p>. Unfortunately, it's outputting both anchors' content in more instances that I expected. Is this doable?
My code from the fiddle:
HTML
<div class="menu">
<a href="page.html">Page 1</a>
<a href="page2.html">Page 2</a>
</div>
JS
$( '.menu a' ).each(function( i ) {
var res = $('.menu a').text();
$('.menu a').after('<p class="pdf">'+ res +'</p>');
});