JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<div>
<input/>
<input/>
</div>
<div>
<input/>
<input/>
</div>
</form>
CSS
div { width:300px; padding: 5px 15px; border-radius: 5px; margin: 3px auto;}
input { width: 145px; }
.curFocus {
border: 1px solid #00f; background: yellow;
}
JavaScript
$('form > div').delegate('input', 'focus', function() {
$(this).closest('div').addClass('curFocus');
}).delegate('input', 'blur', function() {
$(this).closest('div').removeClass('curfocus');
});