JSFiddle - React, Tailwind, and code Playground

HTML

<a href=""  class="link">LINK</a><br>
<input type="text"  class="text" value="" />
<input type="button" onclick="check();" value="Click ME">

JavaScript

function check() {
    var key1 = "some_link1.com";
    var key2 = "some_link2.com";
    var key3 = "some_link3.com";
    var l = document.getElementsByClassName("link")[0];
    var t = document.getElementsByClassName("text")[0];
    if (t.value == "key1" || t.value == "key2" || t.value == "key3") {
        l.href = t.value;
        alert(t.value);
    } }