Je dois activer les options radio basées sur deux radios sélectionnées précédemment, J'ai déjà posé une question sur un pervious topic et j'ai essayé sans succès de l'adapter au nouveau besoin, et j'ai aussi essayé en utilisant la réponse à this topic, mais aussi sans succès ...Désactiver le bouton radio basé sur la sélection radio précédente
Voici donc plus de détails sur ce dont j'ai besoin: Je choisis une radio de chacun des deux groupes radio précédents, donc au troisième groupe devrait être disponible (activé) pour choisir uniquement les deux qui correspondent à la sélection précédente ...
Premier groupe: de, en, es, ca (sélectionné)
Deuxième groupe: de, en (sélectionné), es, ca
Troisième groupe: de (désactivé), en (activé), es (handicapés), ca (activé)
Et voici le code que je utilise:
$(document).ready(function() {
$('input[name=lang_or]').click(function() {
$('input[name=lang_tg]').prop('disabled', false);
$('input[name=lang_tg][value=' + this.value).prop('disabled', 'disabled');
});
});
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<table>
<tr>
<th>Origin language</th>
<th>Target language</th>
<th>Language to index first</th>
</tr>
<tr>
<td>
<label><input type="radio" name="lang_or" value="de">German</label>
<label><input type="radio" name="lang_or" value="en">English</label>
<label><input type="radio" name="lang_or" value="ca">Catalan</label>
<label><input type="radio" name="lang_or" value="es">Spanish</label>
<label><input type="radio" name="lang_or" value="fr">French</label>
<label><input type="radio" name="lang_or" value="it">Italian</label>
<label><input type="radio" name="lang_or" value="pt">Portugues</label>
</td>
<td>
<label><input type="radio" name="lang_tg" value="de">German</label>
<label><input type="radio" name="lang_tg" value="en">English</label>
<label><input type="radio" name="lang_tg" value="ca">Catalan</label>
<label><input type="radio" name="lang_tg" value="es">Spanish</label>
<label><input type="radio" name="lang_tg" value="fr">French</label>
<label><input type="radio" name="lang_tg" value="it">Italian</label>
<label><input type="radio" name="lang_tg" value="pt">Portugues</label>
</td>
<td>
<label><input type="radio" name="language" value="de">German</label>
<label><input type="radio" name="language" value="en">English</label>
<label><input type="radio" name="language" value="ca">Catalan</label>
<label><input type="radio" name="language" value="es">Spanish</label>
<label><input type="radio" name="language" value="fr">French</label>
<label><input type="radio" name="language" value="it">Italian</label>
<label><input type="radio" name="language" value="pt">Portugues</label>
</td>
</tr>
</table>
Eh bien juste d'un coup d'oeil cliquez sur '$ (» input [name = lang_tg] [value = '+ this.value) 'Manque la fin du sélecteur. – Taplar