Skip to content

Commit

Permalink
add document for HTMLButtonElement.type (#32024)
Browse files Browse the repository at this point in the history
* Document for HTMLButtonElement.type

* typo

Co-authored-by: dawei-wang <[email protected]>

* typo

Co-authored-by: skyclouds2001 <[email protected]>

* Update index.md

---------

Co-authored-by: dawei-wang <[email protected]>
Co-authored-by: skyclouds2001 <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
4 people committed Feb 13, 2024
1 parent 85e913a commit 34d914d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions files/en-us/web/api/htmlbuttonelement/type/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "HTMLButtonElement: type property"
short-title: type
slug: Web/API/HTMLButtonElement/type
page-type: web-api-instance-property
browser-compat: api.HTMLButtonElement.type
---

{{ApiRef("HTML DOM")}}

The **`type`** property of the {{domxref("HTMLButtonElement")}} interface is a string that indicates the behavior type of the {{HTMLElement("button")}} element.

It reflects the [`type`](/en-US/docs/Web/HTML/Element/button#type) attribute of the {{HTMLElement("button")}} element.

## Value

A string representing the type.

Its possible values are listed in the attribute's [button types](/en-US/docs/Web/API/HTMLButtonElement#htmlbuttonelement.type) section.

## Example

### HTML

```html
<button id="button" type="reset">type</button>
```

### JavaScript

```js
const buttonElement = document.querySelector("#buttton");
console.log(buttonElement.type); // "reset"
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("HTMLTextAreaElement.type")}} property
- {{domxref("HTMLInputElement.type")}} property

0 comments on commit 34d914d

Please sign in to comment.