JSFiddle - React, Tailwind, and code Playground

by charlescarver

HTML

<input type="text" />
<input type="submit" />

JavaScript

$("input[type=submit]").click(function() {

    var numberRegex = /\d/g;
    var text = $("input[type=text]").val();
    if (numberRegex.test(text)) {

        alert("yes");
    }

});