JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<title>Scrolling DIV demo on iPhone / iPod Touch / Android / iPad</title>

 



</head>

<body>



<input type="text" id="first_text" value="going, used to, to do fast, as soon as possible" />
<input type="text" id="second_text"/>

<input type="button" onclick="replaceText()" value="Click!" />




</body>
</html>

JavaScript

var replaceText = function () {
    var inputval = document.getElementById('first_text').value;
    var arr = {
        "going": "GNG",
        "used to": "UD",
        "as soon as possible": "ASAP",
        "to do fast": "tdf"
    }

    for(var key in arr) {
        if (typeof (arr[key]) !== "undefined") inputval = inputval.replace(key, arr[key])
    }
    document.getElementById("second_text").value = inputval;
}