---
# Submit button withdrawal
**URL:** https://modul-r.codekraft.it/submit-button-withdrawal/
Date: 2021-08-19
Author: Erik
Post Type: post
Summary: you can enable the send withdrawal of the form (like in gmail) and abort the submission. Add this code to functions.php ref. https://wordpress.org/support/topic/withdrawal-button/ GyzFY0LfBxxTFFhCuz
Categories: Blog, Contact form 7
---
you can enable the send withdrawal of the form (like in gmail) and abort the submission. Add this code to functions.php
ref. https://wordpress.org/support/topic/withdrawal-button/
```
var delay = 2000; // set the preferred delay before send email
var interval = null; // don't touch this
jQuery(function ($) {
// displays the button in active state
function sendDisplayON(btn) {
btn.val("Abort?");
btn.addClass("submitting");
$(btn).siblings(".ajax-loader").css("visibility", "visible");
}
// displays the button in normal state
function sendDisplayOFF(btn) {
btn.val("Send");
btn.removeClass("submitting");
$(btn).siblings(".ajax-loader").css("visibility", "hidden");
}
// on submit
$('.wpcf7 input[type="submit"]').on("click", function (e) {
e.preventDefault(); // prevent form submit
var btn = $(this); // store this button into a variable
if (btn.hasClass("submitting")) {
clearInterval(interval); // reset the timeout
sendDisplayOFF(btn);
} else {
sendDisplayON(btn);
interval = setInterval(function () {
// waits delay var value then will trigger this function
clearInterval(interval); // reset the timeout
sendDisplayOFF(btn);
wpcf7.submit(btn.closest("form")[0]); // non ajax forms -> btn.closest("form")[0].submit;
}, delay);
}
});
});
```
---
## Categories
- Blog
- Contact form 7
---
## Navigation
- [Modul*R](https://modul-r.codekraft.it/)
---
## Footer Links
- [WordPress](https://wordpress.org/)