Convert API
formObj()
asyncGets all the data from a form, including files, as an object.
- Accepts a single argument, which should be a DOM element of a form.
-
Returns an object containing the form data.
If the passed argument is not a form, null will be returned.
Example:
await formObj(null);
await formObj($('div'));
// null
await formObj($('form'));
/*
{
'name': 'Alex',
'books': ['book-1', 'book-2'],
'cats': {
'gray': 1,
'white': ['Tom', 'Meow']
}
}
*/