We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

翻譯不完整。請協助 翻譯此英文文件

HTMLElement.click() 方法可以模擬滑鼠點擊一個元素。

click() 被使用在支援的元素(例如任一 <input> 元素),便會觸發該元素的點擊事件。事件會冒泡至 document tree(或 event chain)的上層元素,並觸發它們的點擊事件。其中的例外是:click() 方法不會讓 <a> 元素和接收到真實滑鼠點擊一樣進行頁面跳轉。




Specification Status Comment
Document Object Model (DOM) Level 2 HTML Specification Obsolete Initial definition


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 20[3] (Yes) 5[1] (Yes) (Yes)[2] 6[3]
input@file (limited) (Yes) (Yes) 4 (Yes) 12.10 (Yes)
input@file (full) (Yes) (Yes) 4 (Yes) No support (Yes)
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support No support ? (Yes) ? ? ? ?

[1] Prior to Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), Gecko would not implement the click() method on other elements that might be expected to respond to mouse clicks, such as links (<a> elements), nor would it necessarily fire the click event of other elements.

[2] In Presto-based versions of Opera, the click() method will be silently ignored if made on an <input> with its type attribute set to file and its CSS display property set to none.

[3] Older versions had HTMLInputElement.click(), and HTMLButtonElement.click() only.


 此頁面的貢獻者: jackblackevo
 最近更新: jackblackevo,