How do you change the style of a div programmatically

后端 未结 8 2600
攒了一身酷
攒了一身酷 2021-02-20 06:56

How do I change the style (color) of a div such as the following?

\"
8条回答
  •  遥遥无期
    2021-02-20 07:22

    Generally, you can do it directly

    document.getElementById("myDiv").style.color = "red";

    There's a reference here.

提交回复
热议问题