# give/4.16.9/src/DonationForms/resources/app/hooks/useFormSubmitButton.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 22 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/DonationForms/resources/app/hooks/useFormSubmitButton.ts
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/DonationForms/resources/app/hooks/useFormSubmitButton.ts
- Modified: 2025-04-24T13:50:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/DonationForms/resources/app/hooks/useFormSubmitButton.ts#L10-L20`.

```typescript
/**
 * @since 4.1.1 updated the selector to use the next button classname
 * @since 4.0.0
 */
export default function useFormSubmitButton(): HTMLButtonElement | null {
    const donationFormWithSubmitButton = Array.from(document.forms).pop();

    const submitButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector('[type="submit"]');
    if (submitButton) {
        return submitButton;
    }

    const nextButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector(
        '.givewp-donation-form__steps-button-next[type="button"]'
    );
    if (nextButton) {
        return nextButton;
    }

    return null;
}

```
