JSFiddle - React, Tailwind, and code Playground
by Oliver Kelso
HTML
<a class="trackDownload" target="_blank" href="http://www.gene.com/download/pdf/herceptin_prescribing.pdf">full Prescribing Information</a>
JavaScript
jQuery(".trackDownload").on("click", function (event) {
event.preventDefault();
new_trackDownload(jQuery(this));
});
function new_trackDownload(e) {
var linkName = $(e).text();
console.log(linkName);
var href = $(e).attr('href');
console.log(href);
var index = href.lastIndexOf("/") + 1;
var filename = href.substr(index);
console.log(filename);
externalWindowLink = "false";
console.log("Linkname: " + linkName);
console.log("Filename: " + filename);
}