JSFiddle - React, Tailwind, and code Playground

by ZEZEME

HTML

<ul>
    <li><h3>List heading 1</h3><p>This is list content 1</p></li>
    <li><h3>List heading 2</h3><p>This is list content 2</p></li>
    <li><h3>List heading 3</h3><p>This is list content 3</p></li>
</ul>
<div id="content">
    This is a content in div.
</div>

CSS

p{
    display:none;
}
div {
    border: 1px solid red;
    padding:50px;
}

JavaScript

var divContent = $("#content").html();
$( "li" ).hover(
  function() {
      $("#content").html( $( this ).find("p").html() );
  }, function() {
    $("#content").html( divContent );
  }
);