Tuesday, July 10, 2012

Asp.Net jQuery Loop through Checked RadioButtons in the page


In this post Asp.Net jQuery Loop through Checked RadioButtons in the page, we shall see on how to get the radio button which are checked in a page using jQuery.


We can use the following script to get the checked radio button in a Page


$("input[type=radio][checked]").each(function() {
    alert($(this).attr('id') + ' => ' + $(this).is(':checked'));
});

On click of a button uses the following script.

// Loop through all Checked RadioButtons in the page
$('#cmdLoopChecked').click(function(event) {
    event.preventDefault();
    $("input[type=radio][checked]").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: