「スクワット」、「ベンチプレス」、「デッドリフト」という3つのラジオボタンがあり、関連するドロップダウンメニューを表示したり非表示にしたりします(3回のドロップダウンがありますが、ラジオボタンで表示/非表示
ここでは、「プライマリ」、「セカンダリ」、「アシスタンス」という3つのラジオボタンを追加しました。現在、プライマリ&アシスタントラジオボタンが選択されている場合は、セカンダリが選択されている場合に限り、すべてのドロップダウンが表示されることはありません。セカンダリが選択されているときは、現時点で表示されているものに限ります。私はちょうどそれを働かせるように見えない。
私はこのフィドルが含まれているので、あなたはビジュアルを得て、私が何を意味するのか見ることができます!
$(function() {
$("#datepicker").datepicker({ dateFormat: "yy-mm/dd" }).val()
});
//Script for hiding dropdown menus and showing the one connected
//to the right exercise based on which radiobutton is selected.
$(function() {
$("input[type='radio']").change(function() {
if ($(this).val() == 1 && this.checked) {
$("#exerVariNameS").show();
$("#exerVariNameB").hide();
$("#exerVariNameD").hide();
} else if ($(this).val() == 2 && this.checked){
$("#exerVariNameS").hide();
$("#exerVariNameB").show();
$("#exerVariNameD").hide();
} else if ($(this).val() == 3 && this.checked) {
$("#exerVariNameS").hide();
$("#exerVariNameB").hide();
$("#exerVariNameD").show();
}
});
//Remember which radiobutton was last clicked and keeps it that way
//after a page refresh or form post.
$('input[type=radio]').each(function() {
var state = JSON.parse(localStorage.getItem('radio_' + this.id));
if (state) this.checked = state.checked;
$(this).trigger('change');
});
$(window).bind('unload', function() {
$('input[type=radio]').each(function() {
localStorage.setItem('radio_' + this.id, JSON.stringify({checked: this.checked}));
});
});
});
https://jsfiddle.net/o7m0d4uu/4/
私はひどく説明している場合はお問い合わせください!
、ありますjsFiddleにリンクして質問に[mcve]を追加したときの警告? – j08691
さて、あなたがそれを言う時。私はちょうどそれがとにかく読まれることになる重複であるように感じました! –