JSFiddle - React, Tailwind, and code Playground
by Shahe Masoyan
HTML
<div>
<span>This text is a test text</span>
</div>
CSS
span{
font-size:15pt;
}
JavaScript
$('div').each(function() {
var $this = $(this);
$this.html($this.text().replace(/\b(\w+)\b/g, "<span>$1</span>"));
});
$('div span').hover(
function() {
$(this).css('background-color','#ffff66');
alert(getTheMeaningOfTheWord($(this).html()));
},
function() {
$(this).css('background-color','');
}
);
function getTheMeaningOfTheWord(word){
return word+' = theMeaning';
}