Jquery给RadioButtonList服务器控件添加change事件未执行,求大神解答!详细如下:

asp.net中RadioButtonList服务器控件
<asp:RadioButtonList ID="rb_type" runat="server" RepeatDirection="Horizontal" CellPadding="10" CellSpacing="10" Width="100%">
<asp:ListItem Value="0" Selected="True">文字</asp:ListItem>
<asp:ListItem Value="1">图片</asp:ListItem>
</asp:RadioButtonList>
Jquery:
$("#<%=rb_type.ClientID%> input[type=radio]").change(function(){
if ($(this).val()!="") {
alert("Come here!"+$(this).val());
}
});

第1个回答  2015-07-24
alert($("#<%=rb_type.ClientID%> input[type=radio]").length);
看看是否有数据

追问

length有数据的,但是很奇怪怎么没触发到change事件

追答

如果length有数据,你可以在change事件的第一行代码,alert(123)。应该会触发的。

会不会是你change事件中的代码,有错误?

本回答被网友采纳
相似回答