Change text color with Javascript?

后端 未结 5 2118
执念已碎
执念已碎 2020-12-06 11:02

I want to change the color of a title when a button is clicked. This is my code, but it\'s not working and I can\'t figure out why not...

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 11:42

    innerHTML is a string representing the contents of the element.

    You want to modify the element itself. Drop the .innerHTML part.

提交回复
热议问题