<form id="demo_form">
<input type="submit" value="Click Me!">
</form>
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button {
background-color: #333;
border: none;
color: #fff;
cursor: pointer;
font-size: 16px;
font-weight: 300;
padding: 16px 24px;
text-transform: uppercase;
width: auto;
}
button:hover,
input:hover[type="button"],
input:hover[type="reset"],
input:hover[type="submit"],
.button:hover {
background-color: #e5554e;
color: #fff;
}
jQuery('form').submit(function() {
// when form is submitted for the first time change button text
// and prevent further form submissions
if (jQuery('form input[type="submit"]').data('submitted') == '1') {
return false;
} else {
// I've also added a class and changed the value to make it obvious to the user that the form is submitting
// but this is entirely optional and you can customise this as you wish
jQuery('form input[type="submit"]').attr('data-submitted', '1').addClass('submitting fa fa-spinner fa-spin').val("Submitting");
}
});
This Pen doesn't use any external CSS resources.