Tuesday, July 10, 2012

Asp.Net jQuery loop through RadioButtons in a Page


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

We can use the following script to loop through the RadioButtons

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

On click of a button uses the following script.

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



Related Posts


Search Flipkart Products:
Flipkart.com

No comments: