JSFiddle - React, Tailwind, and code Playground
by netsi1964
HTML
<div id="css-active">Enter CSS</div>
<div id="test">
<p>test P</p>
</div>
JavaScript
jQuery('#css-active').attr('contenteditable', true).on('keydown', function() {
var sText = jQuery(this).text();
var aCss = sText.split('{');
var sSelector = aCss[0];
var $e;
try {
$e = jQuery(sSelector);
} catch(e) {
}
alert(aCss+' => '+$e.length);
if ($e.length>0) {
alert($e.length);
$e.css('background-color', 'rgba(222,222,222,.4)');
}
})