innerHTML与单选按钮安全吗?

huangapple go评论45阅读模式
英文:

is innerHTML with radio buttons safe?

问题

I know that using innerHTML with user input is not safe, but I'm wondering if it's okay if you're using radio buttons, where the only user input is checked vs. unchecked.

我的JS代码如下:

const topsButton = document.getElementById("tops");
topsButton.addEventListener("click", () => {
  chart.innerHTML = "<div>somehtml</div>";
});

这段JS代码嵌入在我的HTML中的 :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定