How can I determine the SelectedValue of a RadioButtonList in JavaScript?

前端 未结 13 2087
一生所求
一生所求 2020-12-16 15:20

I have an ASP.NET web page with a databound RadioButtonList. I do not know how many radio buttons will be rendered at design time. I need to determine the SelectedValue on

13条回答
  •  有刺的猬
    2020-12-16 15:42

    RadioButtonList is an ASP.NET server control. This renders HTML to the browser that includes the radio button you are trying to manipulate using JavaScript.

    I'd recommend using something like the IE Developer Toolbar (if you prefer Internet Explorer) or Firebug (if you prefer FireFox) to inspect the HTML output and find the ID of the radio button you want to manipulate in JavaScript.

    Then you can use document.getElementByID("radioButtonID").checked from JavaScript to find out whether the radio button is selected or not.

提交回复
热议问题