JSFiddle - React, Tailwind, and code Playground

by ten1seven

HTML

<form method="post" action="/tests/37-Foo" id="myForm">
    <input type="hidden" name="_method" value="delete" />
    <input type="hidden" name="authenticity_token" value="123" />
    <input type="submit" value="Destroy Foo!" />
</form>

CSS

input {
    background: none;
    border: none;
    color: #00e;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
    text-decoration: underline;
}
input:hover {
    color: #000;
}

JavaScript

confirmSubmit = function() {
    var agree = confirm("Are you sure?");
    if (agree) {
        return true;
    } else {
        return false;
    }
};
    
myForm = document.getElementById("myForm");
myForm.onsubmit = confirmSubmit;