> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/browser/event/type/mouse/.button.md).

# .button

[browser](/web/browser.md) ⟩ [event](/web/browser/event.md) ⟩ [type](/web/browser/event/type.md) ⟩ [mouse](/web/browser/event/type/mouse.md) ⟩ .button

{% hint style="success" %}
a <mark style="color:yellow;">**number**</mark> associated with <mark style="color:yellow;">**each mouse button**</mark>.

* `0`: Main button (usually the <mark style="color:yellow;">**left**</mark> button)
* `1`: Auxiliary button (usually the <mark style="color:yellow;">**wheel**</mark> button or the <mark style="color:yellow;">**middle**</mark> button)
* `2`: Secondary button (usually the <mark style="color:yellow;">**right**</mark> button)
* `3`: 4th button (typically the <mark style="color:yellow;">**Browser Back**</mark> button)
* `4`: 5th button (typically the <mark style="color:yellow;">**Browser Forward**</mark> button)
  {% endhint %}

<figure><img src="https://2527454625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfvEFZnSBhKT6fJmus0%2Fuploads%2FmS6jHiHWjWUEHhINROwl%2Fmouse.button.png?alt=media&amp;token=7dc88598-50ab-423d-85c8-0637efcdc28e" alt=""><figcaption><p>mouseEvent.button (number)</p></figcaption></figure>

{% tabs %}
{% tab title="👥 相關" %}

* compare with [.buttons](/web/browser/event/type/mouse/.buttons.md) (mouse key combinations)
  {% endtab %}

{% tab title="📘 手冊" %}

* [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) ⟩ [UIEvent](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent) ⟩ [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) ⟩
  * [.buttons](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons) - which buttons are pressed.
  * [.button](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button) - compare with .buttons. (#todo)
    {% endtab %}
    {% endtabs %}
