JSFiddle - React, Tailwind, and code Playground

by ayyadurai

HTML

<form name="form1" id="form1">
<input type="button" id="button" value="click" onClick="what()" />

    <input type="text" id="text" value="hey" />
</form>

JavaScript

var button = document.getElementById("button");
    var div = document.getElementById("box");
    var text = document.getElementById("text");
    var array=[ "thanks for clicking", "keep on clicking", "click one more time", "why do you keep on clicking me?", "stop clicking me!"];
function thing(){
    var y = array[Math.floor((Math.random() * array.length)+1)];
    form1.text.value=y;
}

function what(){
    form1.text.value = "what"; 
                thing();
}