Tuesday, July 10, 2012

Asp.Net jQuery loop through RadioButtonList


In this post Asp.Net jQuery loop through RadioButtonList, we shall see on how to loop through the radio buttons in a RadioButtonList using jQuery.

We can use the following script to loop through the RadioButtons


$('#radListCity input:radio').each(function() {
   alert($(this).attr('id') + ' => ' + $(this).is(':checked'));
});

On click of a button uses the following script.

// Loop through all RadioButtons in a RadioButtonList
$('#cmdLoopList').click(function(event) {
    event.preventDefault();
    $('#radListCity input:radio').each(function() {
        alert($(this).attr('id') + ' => ' + $(this).is(':checked'));
    });
});

To see a full example using jQuery and Radio Buttons refer to the post Asp.Net jQuery Radio Button Tutorial

Search Flipkart Products:
Flipkart.com

No comments: