> For the complete documentation index, see [llms.txt](https://docs.dashcomb.com/dashcomb-help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dashcomb.com/dashcomb-help-center/tips-and-tricks/selectedoptionnowojsdesuru.md).

# 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が表示されたことが確認できます。
