JSFiddle - React, Tailwind, and code Playground

HTML

<form onsubmit="prevent_duplicate(event,this);" action="">
    <input type="text" />
    <input type="submit" />
</form>

JavaScript

function prevent_duplicate(event,form)
{
    if((" "+form.className+" ").indexOf(" submitted ") > -1)
    {
        alert("can't submit more than once!!!");
        event.preventDefault();
    }
    else
    {
        form.classList.add("submitted");
    }
}