ユーザーが選択したいかどうかを確認するために、ステータス、製品タイプ、およびラジオの選択を保持するテーブルがあります。ユーザーがアイテムに対して「いいえ」を選択した場合、同じステータスとカテゴリの行にある他のすべてのラジオ ボタンを無効にしようとしています。
問題は、条件に一致するラジオ ボタンを見つけて選択できないことです。これがjsfiddleです。 http://jsfiddle.net/Ender/LwPCv/
これは明らかに、私が実際にやろうとしていることを過度に単純化したものですが、基本的な概念はこれでカバーしています。本当にありがとう!ああ、私もjqueryを使っています。
私のjsfiddleでは、ユーザーが行1で「いいえ」を選択すると、最後の行のラジオボタンが無効になります。
$(".runTest").click(function () {
$("tr").each(function () {
var curRow = $(this);
var curStatus = curRow.find('td:first').text();
var curRowAccepted = curRow.find('input:radio:checked').val();
//if the current row is not selected find any other matching rows and deselect them;
if (!curRowAccepted) {
//trim the string and extract just the category from a full string;
var curRowCategory = findCategory(curRow.find('td:nth-child(2)').text());
var charAtSplit = curRowCategory.indexOf("-");
curRowCategory = curRowCategory.substr(0, charAtSplit);
curRowCategory = $.trim(curRowCategory);
//I need to disable all other radio buttons that match the Status and Category
$('input:radio').filter($('tr:contains(curRowCategory))').filter($('tr:contains(curStatus))')).disable();
}
});
})