select选中之后隐藏div

来源:互联网 发布:php技术文章 编辑:程序博客网 时间:2024/06/01 23:14
<body><div>    <select class="selectchange" onchange='btnChange(this[selectedIndex].value);' name="" id="selectchange">        <option name="mobai" value="1">摩拜</option>        <option name="yellow" value="2" selected >小黄</option>    </select>    <div id="info" >        <div><input type="checkbox" name="apple" />苹果</div>        <div><input type="checkbox" name="apple" checked="checked"/>苹果</div>        <div><input type="checkbox" name="apple"/>苹果</div>    </div></div></body>
<script src="js/jquery-2.1.1.js"></script><script>    function btnChange(values){        if (values == "2") {            $("#info").css("display","none");            $("input[type='checkbox']").removeAttr("checked");        }else if(values == "1"){            $("#info").css("display","block");        }    }</script>
1 0