Arian Arian - 1 year ago 52
jQuery Question

How to Handle Radio Button List Option change with jQuery

I hava a RadioButtonList control on my page that has multiple option.I want to handle change of its options and, according to value of selected option, do work.

This does not work:

$(document).ready(function () {
$('#RadioButtonList1').change(function () {
if ($(this).is(':checked')) {

How I can Handle that?


Answer Source

You just need to bind the inputs themselves, not their group:

$(document).ready(function () {
    $('#RadioButtonList1 input').change(function () {
        // The one that fires the event is always the
        // checked one; you don't need to test for this