Back to Content

HTMLButtonElement: value property

files/en-us/web/api/htmlbuttonelement/value/index.md

latest731 B
Original Source

{{ APIRef("HTML DOM") }}

The value property of the {{DOMxRef("HTMLButtonElement")}} interface represents the value of the {{htmlelement("button")}} element as a string, or the empty string if no value is set. It reflects the element's value attribute.

Value

A string containing the value of the {{htmlelement("button")}} element.

Examples

js
const buttonElement = document.getElementById("given-name");
console.log(`value: ${buttonElement.value}`);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("button")}}
  • {{DOMXref("HTMLButtonElement.type")}}
  • {{DOMXref("HTMLButtonElement.labels")}}