I am performing a selection on various radio buttons whose class starts with the name radio-selection and has some number at the end (e.g. radio-button1, radio-button2, etc). If the radio button is clicked, certain fields contained with that radio button need to be enabled or disabled. The good part is that the class of the that needs to be enabled matches the radio button # (e.g. radio-option1, radio-option2, etc).
So far, I have this...
$('input:radio[class^=radio-selection]').live('click', function () {
enableDataGroup($(this).siblings('.radio-option1'));
disableDataGroup($(this).siblings('.radio-option2'));
});
I just wanted to prove enabling and disabling works (those are my own functions as the enable and disable can become a bit complicated), but now I need to somehow parse off the numeric value off the radio button that is clicked and enable that data group, and disable all others that don't match. Here is the pseudo-code for what I want to do. Unfortunately, I'm not sure what to search for in Google that will teach me how to parse off and add those numeric values.
$('input:radio[class^=radio-selection]').live('click', function () {
var i = // Parse off the number off the selector of $(this).
enableDataGroup($(this).siblings('.radio-option' + i));
// Disable every other .radio-option[X] where [X] != i
});