JSFiddle - React, Tailwind, and code Playground

by reporter

HTML

<form name="myform" method="post" action="your target url" onClick="check(this)">
            <input type="text" id="Codecvv" name="cvv" placeholder="352 (can be 4 digits)">
            <input type='button' value='Checkout Now!' id='btn'>
            <input type="hidden" id='hidden' name="hidden" value="--1"> 
 </form>

JavaScript

function check(ooo) {
    let inputstate = document.forms[ooo.name].hidden.value;
    if (inputstate == "-1"){
         alert(1);
         return false;
    } 
    document.forms[ooo.name].submit();
}