diff options
author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-10-28 02:00:01 +0900 |
---|---|---|
committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-11-04 21:36:13 +0900 |
commit | ed4edb19c89e81e9f6e68f6820b166d106519be6 (patch) | |
tree | aaa2ad0f16fad2a547ec5011d5c3e40180555b96 /files/ja/web/api/htmlselectelement/options | |
parent | 485a48198a98d7213af29b946d473c9c3329a6b1 (diff) | |
download | translated-content-ed4edb19c89e81e9f6e68f6820b166d106519be6.tar.gz translated-content-ed4edb19c89e81e9f6e68f6820b166d106519be6.tar.bz2 translated-content-ed4edb19c89e81e9f6e68f6820b166d106519be6.zip |
Web/API/HTMLSelectElement 以下の文書を更新
- 2021/10/27 時点の英語版に同期
- add, checkValidity, disabled, form, labels, namedItem, remove, selectedIndex, selectedOptions, setCustomValidaty, type については新規翻訳
Diffstat (limited to 'files/ja/web/api/htmlselectelement/options')
-rw-r--r-- | files/ja/web/api/htmlselectelement/options/index.md | 81 |
1 files changed, 32 insertions, 49 deletions
diff --git a/files/ja/web/api/htmlselectelement/options/index.md b/files/ja/web/api/htmlselectelement/options/index.md index 9104769ff0..1af533e1e4 100644 --- a/files/ja/web/api/htmlselectelement/options/index.md +++ b/files/ja/web/api/htmlselectelement/options/index.md @@ -5,72 +5,55 @@ tags: - API - HTMLSelectElement - Options - - Property - - Read-only - - Web - - ウェブ - プロパティ + - 読み取り専用 + - ウェブ +browser-compat: api.HTMLSelectElement.options translation_of: Web/API/HTMLSelectElement/options --- -<div>{{APIRef("DOM")}}</div> +{{APIRef("DOM")}} -<p><code><strong>HTMLSelectElement.options</strong></code> は読み取り専用のプロパティで、 {{HTMLElement("select")}} 要素に含まれる {{HTMLElement("option")}} 要素の {{domxref("HTMLOptionsCollection")}} を返します。</p> +**`HTMLSelectElement.options`** は読み取り専用のプロパティで、{{domxref("HTMLOptionsCollection")}} で {{HTMLElement("select")}} 要素に含まれる {{HTMLElement("option")}} 要素を返します。 -<h2 id="Syntax" name="Syntax">構文</h2> +## 構文 -<pre class="syntaxbox">var <var>options</var> = <var>select</var>.options; -</pre> +```js +var options = select.options; +``` -<h3 id="Return_value" name="Return_value">返値</h3> +## 返値 -<p><code><select></code> 要素に含まれる <code><option></code> 要素の {{domxref("HTMLOptionsCollection")}} です。</p> +{{domxref("HTMLOptionsCollection")}} で、`<select>` 要素に含まれる `<option>` 要素を返します。 -<h2 id="Example" name="Example">例</h2> +<h2 id="Example">例</h2> -<h3 id="HTML">HTML</h3> +### HTML -<pre class="brush: html"><label for="test">Label</label> -<select id="test"> - <option value="1">Option 1</option> - <option value="2">Option 2</option> -</select> -</pre> +```html +<label for="test">ラベル</label> +<select id="test"> + <option value="1">Option 1</option> + <option value="2">Option 2</option> +</select> +``` -<h3 id="JavaScript">JavaScript</h3> +### JavaScript -<pre class="brush: js">window.addEventListener("DOMContentLoaded", function() { +```js +window.addEventListener("DOMContentLoaded", function() { const select = document.getElementById("test"); - for(var i = 0; i < select.options.length; i++) { - console.log(select.options[i].label); // "Option 1" and "Option 2" + for(var i = 0; i < select.options.length; i++) { + console.log(select.options[i].label); // "Option 1" および "Option 2" } -});</pre> +}); +``` -<p>{{EmbedLiveSample("Example", "100%", 30)}}</p> +{{EmbedLiveSample("Example", "100%", 30)}} -<h2 id="Specifications" name="Specifications">仕様書</h2> +## Specifications -<table class="standard-table"> - <thead> - <tr> - <th scope="col">仕様書</th> - <th scope="col">状態</th> - <th scope="col">備考</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName("HTML WHATWG", "form-elements.html#the-select-element:htmloptionscollection", "options")}}</td> - <td>{{Spec2("HTML WHATWG")}}</td> - <td>変更なし</td> - </tr> - <tr> - <td>{{SpecName("HTML5 W3C", "forms.html#htmlselectelement", "options")}}</td> - <td>{{Spec2("HTML5 W3C")}}</td> - <td>初回定義</td> - </tr> - </tbody> -</table> +{{Specifications}} -<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> +## Browser compatibility -<p>{{Compat("api.HTMLSelectElement.options")}}</p> +{{Compat}} |