This feature is not Baseline because it does not work in some of the most widely-used browsers.
The HTMLSelectElement.showPicker() method displays the browser picker for a select element.
This is the same picker that would normally be displayed when the element is selected, but can be triggered from a button press or other user interaction.
showPicker()
None.
None (undefined).
InvalidStateError DOMException
Thrown if the element is not mutable, meaning that the user cannot modify it and/or that it cannot be automatically prefilled.
NotAllowedError DOMException
Thrown if not explicitly triggered by a user action such as a touch gesture or mouse click (the picker requires Transient activation).
NotSupportedError DOMException
Thrown if the element associated with the picker is not being rendered.
SecurityError DOMException
Thrown if called in a cross-origin iframe.
Transient user activation is required. The user has to interact with the page or a UI element in order for this feature to work.
The method is only allowed to be called in same-origin iframes; an exception is thrown if this is called in a cross-origin iframe.
The code below shows how to check if showPicker() is supported:
if ("showPicker" in HTMLSelectElement.prototype) {
// showPicker() is supported.
}
This example shows how to use a button to launch the picker for a <select> element with two options.
<p>
<select>
<option value="1">One</option>
<option value="2">Two</option>
</select>
<button type="button">Show Picker</button>
</p>
The code gets the <button> and adds a listener for its click event. The event handler gets the <select> element and calls showPicker() on it.
const button = document.querySelector("button");
button.addEventListener("click", (event) => {
const select = event.srcElement.previousElementSibling;
try {
select.showPicker();
} catch (error) {
window.alert(error);
}
});
| Specification |
|---|
| HTML> # dom-select-showpicker> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
showPicker |
121 | 121 | 122 | 107 | preview | 121 | 122 | 81 | No | 25.0 | 121 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/showPicker