JSFiddle - React, Tailwind, and code Playground

HTML

<div id="un">

</div>
<div id="deux">

</div>

CSS

div{ border: solid 1px silver;
height: 100px;}
.sel { border: solid 1px red; }

JavaScript

$(function(){
var sel;
 $('#un, #deux').on("click", function(){ 
 sel=$(this).attr('id');
$('div').removeClass('sel');
$(this).addClass('sel');
});

$('body').on('keydown', function(e){
 $('#'+sel).html( $('#'+sel).html() +String.fromCharCode(e.keyCode)) ;
})

})