DOM Methods

FormData.has()

Tests whether at least one entry has the given name, regardless of whether its value is empty. It does not validate the field contents. Example result: true/false.

Formal Syntax & Structure

html syntaxhtml
data.has(name)

Parameters & Attributes

NameTypeDescription
namestringField name; matching is case-sensitive.

Return Value

boolean

True when an entry exists.

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