JSFiddle - React, Tailwind, and code Playground

HTML

<input type="textbox"/>
<a>click to test</a>

JavaScript

$("a").click(function() {
    var version = $("input").val();
    var index = version.indexOf(".");
    if (index != -1) {
        version = version.substring(0, index);
    }
    alert(version);
});