HTMLSelectElement: required プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

requiredHTMLSelectElement インターフェイスのプロパティで、フォームを送信する前に、ユーザーが空ではない文字列値を持つオプションを選択しなければならないことを指定します。これは、<select> 要素の required 属性を反映したものです。

論理値です。

js
const selectElement = document.getElementById("fruits");
console.log(selectElement.required);

仕様書

Specification
HTML
# dom-select-required

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
required

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報