useCurrencyFormatter.ts
2 years ago
useDonationSummary.ts
1 year ago
useFormData.ts
1 year ago
useFormSubmitButton.ts
1 year ago
useVisibilityCondition.ts
2 years ago
useFormSubmitButton.ts
19 lines
| 1 | /** |
| 2 | * @since 4.0.0 |
| 3 | */ |
| 4 | export default function useFormSubmitButton(): HTMLButtonElement | null { |
| 5 | const donationFormWithSubmitButton = Array.from(document.forms).pop(); |
| 6 | |
| 7 | const submitButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector('[type="submit"]'); |
| 8 | if (submitButton) { |
| 9 | return submitButton; |
| 10 | } |
| 11 | |
| 12 | const nextButton: HTMLButtonElement = donationFormWithSubmitButton?.querySelector('[type="button"]'); |
| 13 | if (nextButton) { |
| 14 | return nextButton; |
| 15 | } |
| 16 | |
| 17 | return null; |
| 18 | } |
| 19 |