Skip to content
Advertisement

it’s possible to obtain the data stored in a label label to assign it to another variable and thus be able to graph it?

my label

Porcentaje:

here I am adding the result of my operation to the label
document.getElementById(“percentage1”).innerHTML = perc1 + “%”;

I am trying to assign it to another variable the value of the label let PorcElement6 = document.getElementById(“percentage1”).label;

I am trying to add that variable to the graph data: [PorcElement6, PorcElement7, PorcElement8, PorcElement9, PorcElement10],

Advertisement

Answer

Read it with .innerText, for example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement