# selectedOptionの属性をJSで取得する

RadioBox、CheckBox、Selectの選択結果に対して、**selectedOption**で属性をJSで取得できます。

checkboxの属性を取得しラベルに表示をしてみます。\
ラベルへの表示方法は、[ラベル文字をJavaScriptで設定](/dashcomb-help-center/tips-and-tricks/raberuwojavascriptde.md)も参照してください。

<figure><img src="/files/ReXxor2evD8tRVd7hV76" alt=""><figcaption></figcaption></figure>

* チェックボックスコンポーネントとラベルコンポーネントをドラッグアンドドロップで設置します。
* どちらかのコンポーネントを選択しJavaScriptを追加します。
* チェックボックスのオブジェクトに任意の名前入力（ここではcheckboxとしている）とラベルに任意の名前（ここではgetCheckboxとしている）を入力します。
* 本番処理の例として以下を記述します。\
  let index\
  index = checkbox.selectedOption\[0].index\
  getCheckbox.setValue(index)
* 実行ボタンを押下し「実行に成功しました」が表示され、ラベル文字に取得したselectedOptionのindexが表示されたことが確認できます。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dashcomb.com/dashcomb-help-center/tips-and-tricks/selectedoptionnowojsdesuru.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
