JSFiddle - React, Tailwind, and code Playground

HTML

<html>
  <head>
    <script type="text/javascript">
        $(document).ready(function(){
        
        var words = $("p:first").text().split(" ");
        var text = words.join("</div> <div>");
        $("p:first").html("<div>" + text + "</div>");
        $("div").click(function () {
            $(this).css("background-color","yellow");      
        });

        });
    </script>

  </head>
  <body>
    <body>
          <p>word1 word2 word3</p>
                 
    </body>
</html>