diff --git a/src/form-data-json.ts b/src/form-data-json.ts index 851e060..6332c6c 100644 --- a/src/form-data-json.ts +++ b/src/form-data-json.ts @@ -748,12 +748,21 @@ export default class FormDataJson { isValidInput: ((input: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLElement) => boolean | undefined) | null = null, options: FormDataJsonOptionsToJson | FormDataJsonOptionsFromJson | FormDataJsonOptionsReset | FormDataJsonOptionsClear ): any { - const el = FormDataJson.getElement(checkEl) - if (!el) { - return [] + let inputs = []; + if (Array.isArray(checkEl)) { + inputs = checkEl; + } + else if (checkEl.jquery && checkEl.length>1) { + const el = null; + inputs = checkEl.toArray(); + } + else { + const el = FormDataJson.getElement(checkEl); + if (!el) { + return []; + } + inputs = Array.from(el.querySelectorAll('select, textarea, input, button')); } - - let inputs = Array.from(el.querySelectorAll('select, textarea, input, button')) // if we have a form with a name, we need to find all attributes that have a "form" attribute with that name as value as well if (options.includeLinkedFormElements && el instanceof HTMLFormElement && el.getAttribute('id')) { const formId = el.getAttribute('id') @@ -902,4 +911,4 @@ export default class FormDataJson { } return c } -} \ No newline at end of file +}