JSFiddle - React, Tailwind, and code Playground

by Cam Gould

HTML

<p>Here is a sentence <span id="rotate">this</span> is what changes</p>

JavaScript

var terms = ["term 1", "term 2", "term 3"];

function rotateTerm() {
  var ct = $("#rotate").data("term") || 0;
  $("#rotate").data("term", ct == terms.length -1 ? 0 : ct + 1).text(terms[ct]).fadeIn()
              .delay(3000).fadeOut(200, rotateTerm);
}
$(rotateTerm);