JSFiddle - React, Tailwind, and code Playground

HTML

<form method="post" onsubmit="reverseInput(); return false;">
    <p>
        <input type="text" id="inputValue" />
        <input type="submit" value="Submit" />
    </p>
</form>
<p id="result"></p>

JavaScript

String.prototype.reverse = function() {
    return this.split("").reverse().join("");
};

function reverseInput() {
    var inputValue = document.getElementById("inputValue").value;
    var newValue = inputValue.reverse();
    document.getElementById("result").innerHTML = inputValue + ": " + newValue;
};