I have developed a Chrome extension with a feature that involves looping a list of links into a .div element. Here is the code snippet:
function updateIcd() {
modalIcdLinks.innerHTML = '';
let icdLinks = '';
for (let i = 0; i < icdCodes.length; i++) {
icdLinks += '<a href="#" onclick="removeIcd('+i+')">'+ icdCodes[i] +' [x]</a><br />'
}
modalIcdLinks.innerHTML = icdLinks;
}
When one of these links is clicked, it should pass the parameter to the removeIcd function in order to remove it from the array.
The issue I am facing is that Chrome extensions do not support inline scripting for security reasons. This means I need to find an alternative way to pass the value (like the array index) to my JavaScript function when a link is clicked without using inline scripting. Any suggestions on how to achieve this?