JSFiddle - React, Tailwind, and code Playground
HTML
<div class="info" title="ejemplo1"> Cuando pongas el cursor encima aparecera un texto en otro div. </div>
<div class="info" title="ejemplo2"> Cuando pongas el cursor encima aparecera un texto en otro div. </div>
<div id="ejemplo1"style="display: none"> Ejemplo 1 </div>
<div id="ejemplo2"style="display: none"> Ejemplo 2 </div>
<div id="welcome" style="display: none"> Contenido cuando no tienes el cursor encima de info. </div>
<div class="texto" />
JavaScript
$(".info").hover(
function() {
// Utilizamos el metodo 'attr' para acceder a las propiedades del nodo
var title = $(this).attr('title');
$(".texto").html($("#" + title).html());
},
function() {
$(".texto").html($("#welcome").html());
}
);