How do I get the text of a radio button (not the value)

后端 未结 4 1990
夕颜
夕颜 2021-01-21 05:48

I know I can get the \"value\" attribute of a radiobutton but I\'m finding it strangely difficult to get the text of the radiobutton.

Consider the example below. It has

4条回答
  •  旧时难觅i
    2021-01-21 06:13

    elem.nextSibling.nodeValue.replace('\n', '')
    

    The replace is to get rid of the newline (may be different on different OSes, I am running Windows) character which is there for some reason.

提交回复
热议问题