0

私が書いたこのコードは機能しますが、それが最善の解決策だとは思いません。

私がやっていることは、特定のラジオがチェックされているかどうかを確認することです。このラジオがチェックされている場合は、この div を表示するかどうかを確認します。

誰かがこれについて正しい方向に私を向けることができますか?

$(document).ready(function(){

$('.Form').hide();

$('input').click(function(){

    <!--check if its One-->
        if ($('input[value=informed]:checked').length) {

        $('#ContactFormOne').show();

        $("#ContactFormTwo,#ContactFormThree,#ContactFormFour,#ContactFormFive,#ContactSix'").hide();

     <!--check if its Two-->

        } else if ($('input[value=release]:checked').length) {

        $('#ContactFormTwo').show();

        $("#ContactFormOne,#ContactFormThree,#ContactFormFour,#ContactFormFive,#ContactSix'").hide();

     <!--check if its Three-->

        } else if ($('input[value=intake]:checked').length) {

        $('#ContactFormThree').show();

        $("#ContactFormTwo,#ContactFormOne,#ContactFormFour,#ContactFormFive,#ContactSix'").hide();

      <!--check if its Four-->      

        }  else if ($('input[value=checklist]:checked').length) {

        $('#ContactFormFour').show();

        $("#ContactFormTwo,#ContactFormOne,#ContactFormThree,#ContactFormFive,#ContactSix'").hide();

      <!--check if its Fiver-->     

        } else if ($('input[value=health]:checked').length) {

        $('#ContactFormFive').show();

        $("#ContactFormTwo,#ContactFormOne,#ContactFormThree,#ContactFormFour,#ContactSix'").hide();


         }
    })

});
4

0 に答える 0