Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 533 B

12345678910111213141516171819202122
  1. # get-form-values
  2. Get the value of a form using `HTMLFormElement.elements`.
  3. ## Usage
  4. ```typescript
  5. import getFormValues from '@theoryofnekomata/get-form-values';
  6. const form = document.getElementById('form')
  7. // optional, but just in case there are multiple submit buttons in the form,
  8. // individual submitters can be considered
  9. const submitter = form.querySelector('[type="submit"]')
  10. const values = getFormValues(form, submitter)
  11. ```
  12. ## Tests
  13. The library has been tested on JSDOM through Jest, and the real DOM using
  14. Cypress.