How do I get the label of the selected radio button using javascript

后端 未结 2 1982
囚心锁ツ
囚心锁ツ 2020-12-21 07:31

I have the following HTML

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-21 07:56

    A radiobutton have no innerhtml. You need to target the label. If it's always directly after the radio-button, try something like radios[i].nextSibling.innerhtml.

提交回复
热议问题