JSFiddle - React, Tailwind, and code Playground

by 阿健 Kerry

HTML

<div id="div1" style="background:red;">
修改背景颜色
</div>
<button type="button" onclick="update();">修改背景</button>

JavaScript

update = function (){
  var div1 = document.getElementById('div1');
  div1.style.backgroundColor="black";
}