我需要帮助下一步做什么JS

时间:2017-01-20 09:54:22

标签: javascript forms css3 radio-button

             <form>
               <input type="radio" name="gender" value="Male">Male </br>
               <input type="radio" name="gender" value="Female"> Female
             </form>

例子:当我检查男性然后我会去导航并选择衣服所以它将理清将在服装中显示的东西都是男性服装反之亦然

sample html

sample navigation after choosing male or female

1 个答案:

答案 0 :(得分:0)

这会对你有所帮助

        <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
        <form>
          <input id="male" type="radio" name="gender"value="Male">Male
          <input id="female" type="radio" name="gender" value="Female">Female
        </form>

        <li>
        <a id="accesory" href="accesroy">Accesory</a>
          <a id="maleapparel" style="display:none" href="maleapparellink">Male Apparel</a>
          <a id="femaleapparel" style="display:none" href="femaleapparellink">Female Apparel</a>
        </li>

    <---js--->
    <script>
$(document).on('click','#male',function(){
    $("#accesory").hide();
        $("#femaleapparel").hide();
        $("#maleapparel").show();
    });
    $(document).on('click','#female',function(){
            $("#accesory").hide();
        $("#maleapparel").hide();
        $("#femaleapparel").show();
    });
</script>
    <---js--->