JSFiddle - React, Tailwind, and code Playground
by Oliver_kh
HTML
<form type="post">
<input type="text" value="">
<button type="submit" id="d" value="go">go</button>
</form> <span>0</span>
JavaScript
$(function () {
$("form").submit(function (event) {
if ($("input:first").val() === "correct") {
$("span").text("Validated...").show();
return;
}
$("span").text(parseInt($("span").text()) + 1).show();
return false;
});
$('#d').click(function () {
$(this).parents('form').submit();
return false;
});
$("form").submit();
});