Back to Content

FormData: values() method

files/en-us/web/api/formdata/values/index.md

latest959 B
Original Source

{{APIRef("XMLHttpRequest API")}} {{AvailableInWorkers}}

The FormData.values() method returns an iterator which iterates through all values contained in the {{domxref("FormData")}}. The values are strings or {{domxref("Blob")}} objects.

Syntax

js-nolint
values()

Parameters

None.

Return value

An iterator of {{domxref("FormData")}}'s values.

Examples

js
const formData = new FormData();
formData.append("key1", "value1");
formData.append("key2", "value2");

// Display the values
for (const value of formData.values()) {
  console.log(value);
}

The result is:

plain
value1
value2

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also