JSFiddle - React, Tailwind, and code Playground

HTML

<fieldset>
<legend > background color change:</legend>
<div id="div_field">
<img src="home.png" name="img_png" width="200"  />
</div>
<form >
<input type="button"  name="red"  value="Red" id="but1_id" onclick= "return button_fn(this.id)"/>
<input type="button"  name="green" value="Green" id="but2_id" onclick="button_fn(this.id)"/>
<input type="button"  name="blue" value="Blue" id="but3_id" onclick="button_fn(this.id)"/>
<input type="button"  name="confirm" value="OK" id="confirm_id" onclick="button_fn(this.id)"/>
</form>
</fieldset>
<div id="div_image" >
        <img src="service2.jpg" id="img_id" name="imag" width="200"border="40" />   
    </div>

JavaScript

function button_fn(Obj) 
{alert("hi");
     document.getElementById("div_field").style = "background-color:"+Obj.name;
    document.getElementById("img_id").style="border-color:"+Obj.name;
}