JSFiddle - React, Tailwind, and code Playground
by guest271314
HTML
<div>this is just a simple text. this is just a simple text. this is just a simple text. this is just a simple text. How are you man today. I Have been working on this.</div>
JavaScript
$(function () {
$("div")
.data("r", ["simple text", 3, "hello"])
.text(function (i, o) {
var r = $(this).data("r");
return o.replace(new RegExp(r[0], "g"), function (m) {
++i;
return (i === r[1]) ? r[2] : m
})
}).data("r", []);
});