0453e461c9
Updating dependencies
19 lines
505 B
JavaScript
19 lines
505 B
JavaScript
export default function getFormData(element) {
|
|
let data = {};
|
|
if (
|
|
element.name !== undefined &&
|
|
element.name !== null &&
|
|
element.name !== ""
|
|
) {
|
|
if (typeof element.name === "string") {
|
|
if (element.type === "checkbox") data[element.name] = element.checked;
|
|
else data[element.name] = element.value;
|
|
}
|
|
}
|
|
element.childNodes.forEach((child) => {
|
|
let res = getFormData(child);
|
|
data = Object.assign(data, res);
|
|
});
|
|
return data;
|
|
}
|