Estoy usando una API de terceros para mostrar un gráfico de gráficos altos. En este gráfico hay una sección de créditos que desde esta API de terceros no está redirigiendo a ningún lado. Debido a que es de un tercero, no tengo la capacidad de editar el código de Highcharts directamente. Me gustaría editar este elemento de texto para agregar un href para que al hacer clic en él se redirija a una página diferente. ¿Es esto posible a partir de un elemento de texto?
Estoy intentando convertir esto sin href:
<text x="1190" class="highcharts-credits" text-anchor="end" data-z-index="8" style="cursor:pointer;color:#777770;font-size:9px;line-height:10px;font-family:roboto;font-weight:normal;text-shadow:false;fill:#777770;" y="275" aria-hidden="false">Example.com © Natural Earth</text>en con href:
<text x="10" class="highcharts-credits" text-anchor="start" data-z-index="8" style="cursor:pointer;color:#999999;font-size:9px;fill:#999999;" y="495"><title>Copyright (c) 2020 Highsoft AS, Based on data from Natural Earth</title>Example.com © <a href="http://www.naturalearthdata.com">Natural Earth</a></text> Intenté lograr esto obteniendo la clase highcharts-credits y haciendo un evento onclick para redirigir a la página que espero aquí. Al hacer esto nada está cambiando.
Aquí está mi fragmento de código:
let textChange = document.getElementsByClassName("highcharts-credits"); textChange.onclick = function () { location.href = "www.google.com"; }; <text x="1190" class="highcharts-credits" text-anchor="end" data-z-index="8" style="cursor:pointer;color:#777770;font-size:9px;line-height:10px;font-family:roboto;font-weight:normal;text-shadow:false;fill:#777770;" y="275" aria-label="Chart credits: Source: IBISWorld, Advertising Agencies" aria-hidden="false">Example.com © Natural Earth</text>