From ff4716632c48438fb6c9bd642cc14a2357ca2921 Mon Sep 17 00:00:00 2001 From: Serik Date: Thu, 4 Jul 2024 01:49:50 +0500 Subject: [PATCH] formData --- readme.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.md b/readme.md index ea781a7..9e19ccb 100644 --- a/readme.md +++ b/readme.md @@ -206,3 +206,14 @@ export class Basket extends LitElement { } customElements.define("app-basket", Basket); ``` + +## Get form values in one shot + +```js +submit(e){ + e.preventDefault() + const formData = new FormData(e.target) + const formProps = Object.fromEntries(formData) + // {a: 1, b: 2} +} +```