I wired the Change event handler for an ASP.NET radiobuttonlist like this in the ready()
handler in jQuery like this:
$("#<%=rblYesNo.ClientID%>").change(MyFunction);
When I select one of the radio buttons, MyFunction
doesn't get called. Why?
Remember, a radio button list doesn't have a single identifier. The radio buttons are linked together by their NAME. If I recall, rblYesNo.ClientID will probably be just a div that wraps the radio buttons. Try:
$("#<%=rblYesNo.ClientID%> input").change(function(){
});
IE has a problem with the 'change' event on radio buttons, try using click instead:
$("#<%=rblYesNo.ClientID%>").click(MyFunction);
$("#<%=rblYesNo.ClientID%> input").change(function(){ });
and
$("#<%=rblYesNo.ClientID%>").click(MyFunction);
it may works in simple page. what if there is AjaxControlToolkit TabPanel in page? it will not works. Because radio button list will be on other tab so it will find by the jquery and event cannot registered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With