https://amitad16.github.io/stringRoller.js/
No dependacies! Written in plain javascript.
StringChange(selector, { finalText: Some string }).roll();
<p id='stringRoller'>What is this?</p>
<button type='button' id='roll'>Roll It</button>
window.onload = () => {
let rollBtn = document.querySelector("button#roll");
rollBtn.addEventListener("click", () => {
StringChange("#stringRoller", {
finalText: "This is StringRoller.js"
}).roll();
});
};
<html>
<head>
<title>StringRoller.js</title>
</head>
<body>
<p id='stringRoller'>What is this?</p>
<button type='button' id='roll'>Roll It</button>
<script src="./src/stringRoller.js"></script>
<script>
window.onload = () => {
let rollBtn = document.querySelector("button#roll");
rollBtn.addEventListener("click", () => {
StringRoller('#stringRoller', { finalText: "This is StringRoller.js" }).roll();
});
}
</script>
</body>
</html>
{
// Mandatory options
finalText: 'Some text', // String to change to
}
Licensed under the MIT license.