Sunday, 15 July 2012

asp.net - get ASPX radiobutton text or value from javascript -



asp.net - get ASPX radiobutton text or value from javascript -

aspx radiobuttons within datalist template

<asp:radiobutton id="radiobutton1" runat="server" groupname="rdb" text='<%# eval("type1") %>' onclick="getr1(this)"/>

javascript

function getr1(val){ alert(val) }

if utilize function in html control, homecoming value not working in aspx radiobuttons. used code: onchange="getqty(this.options[this.selectedindex].value)" selected index aspx dropdownlist , works fine, maybe can help me figure out right syntax aspx rb. tried onclick="getr1(this.options[this.checked].value)", in advance

your code fine, need little change.

<asp:radiobutton id="radiobutton1" runat="server" cliientidmode="static" groupname="rdb" text='<%# eval("type1") %>' />

and

<asp:label id="label1" runat="server" style="font-size: x-small" text='<%# eval("type1") %>'></asp:label>

jquery getting radiobutton text:

$("#radiobutton1").click(function{ alert( $(this).siblings('label').text()); });

jquery getting asp:label text next radiobutton:

$("#radiobutton1").click(function{ alert( $(this).siblings('span').text()); });

hope helps :)

javascript asp.net radio-button

No comments:

Post a Comment