DOM Methods

FormData.get()

Reads the first value for a name without removing entries. Distinguish a missing field (null) from an existing empty string; use getAll for repeated values. Example result: html.

Formal Syntax & Structure

html syntaxhtml
data.get(name)

Parameters & Attributes

NameTypeDescription
namestringField name; matching is case-sensitive.

Return Value

string | File | null

First value or null.

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