JSFiddle - React, Tailwind, and code Playground
HTML
<div id="target">Highlight Me</div>
CSS
#target { width: 300px; height: 100px; border: 1px solid red; }
JavaScript
jQuery.fn.highlight = function() {
$(this).each(function() {
var el = $(this);
el.before("<div/>")
el.prev()
.width(el.width())
.height(el.height())
.css({
"position": "absolute",
"background-color": "#ffff99",
"opacity": ".9"
})
.fadeOut(500);
});
}
$("#target").highlight();