DOM Methods

FormData.getAll()

Collects all values for the given name in entry order. An absent name yields an empty array, not null. The returned array is not a live view of the entry list. Example result: ["html","css"].

Formal Syntax & Structure

html syntaxhtml
data.getAll(name)

Parameters & Attributes

NameTypeDescription
namestringField name; matching is case-sensitive.

Return Value

Array<string | File>

Array of matching values.

Working Example

Example Snippethtml
<p>  Result:  <output id="result"></output></p><script>  const result = document.getElementById("result");  (async () => {  const data = new FormData();  data.append("tag", "html");  data.append("tag", "css");  result.textContent = JSON.stringify(data.getAll("tag"));  })().catch(error => { result.textContent = "Error: " + error.name; });</script>
HTML Reference