JSFiddle - React, Tailwind, and code Playground

by safarov

HTML

<div id="text2">here test</div><br />
Enter color code here: <input type="text" value="green" id="inputcolor"><br>
<input type="button" value="change color to yellow" id="button2"><br>

CSS

#text2 {border:1px solid red;backgroud-color:#aaa;width:100px;height:100px;}

JavaScript

$('#button2').on('click', function() {

    $('#text2').css('background-color', $('#inputcolor').val());
    
});