Where to store data awaiting to be put into the html
Hey, what is the recommended way to store data awaiting to be inserted into the html?
for example, let's say when i click a button, the text inside changes. Where would it be appropriate to store that awaiting value?
obviously
You could store the value in a data attribute too which would allow easy editing without editing the javascript, but i feel that could pose security risks?
I know that you can use things like template for things too but I’m more referring to use cases like this example.
i'd appreciate any insight, thanks in advance.
for example, let's say when i click a button, the text inside changes. Where would it be appropriate to store that awaiting value?
obviously
button.textContent = 'Clicked' would be inefficient on a larger scale so putting it in a variable could be good, however something about that doesn't seem right, especially on a larger scale You could store the value in a data attribute too which would allow easy editing without editing the javascript, but i feel that could pose security risks?
I know that you can use things like template for things too but I’m more referring to use cases like this example.
i'd appreciate any insight, thanks in advance.