JSFiddle - React, Tailwind, and code Playground
by Chris Rebert
HTML
<input type="text" /><br />
<input type="search" id="q" />
<div id="result"></div>
CSS
div {
width: 100px;
height: 100px;
background-color: red;
}
.success {
background-color: green;
}
JavaScript
if (document.getElementById('q').type.toLowerCase() === 'search') {
document.getElementById('result').className = 'success';
}