DOM Methods

FormData.append()

Adds another entry even when the name already exists. Use for repeated choices or multiple files. Unlike set(), it does not remove previous values. Example result: ["html","css","js"].

Formal Syntax & Structure

html syntaxhtml
data.append(name, value, filename?)

Parameters & Attributes

NameTypeDescription
namestringField name; matching is case-sensitive.
valuestring | BlobValue to store; non-Blob values are converted to strings.
filenamestringOptional filename when value is a Blob or File.

Return Value

undefined

No return value.

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");  data.append("tag", "js"); result.textContent = JSON.stringify(data.getAll("tag"));  })().catch(error => { result.textContent = "Error: " + error.name; });</script>
HTML Reference