| 1 |
/** |
| 2 |
* @since 4.1.1 updated the selector to use the next button classname |
| 3 |
* @since 4.0.0 |
| 4 |
*/ |
| 5 |
export default function useFormSubmitButton(): HTMLButtonElement | null { |
| 6 |
const donationFormWithSubmitButton = Array.from(document.forms).pop(); |
| 7 |
|
| 8 |
const submitButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector('[type="submit"]'); |
| 9 |
if (submitButton) { |
| 10 |
return submitButton; |
| 11 |
} |
| 12 |
|
| 13 |
const nextButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector( |
| 14 |
'.givewp-donation-form__steps-button-next[type="button"]' |
| 15 |
); |
| 16 |
if (nextButton) { |
| 17 |
return nextButton; |
| 18 |
} |
| 19 |
|
| 20 |
return null; |
| 21 |
} |
| 22 |
|