tab 切换
原创一个好人随笔 jQuery12 阅读半小时前
- <style type="text/CSS">
- box div{
- width: 200px;
- height: 200px;
- border: 1px solid green;
- display: none;
- }
- .active{
- background: orange;
- }
- </style>
- <script src="js/jquery-3.3.1.min.js"></script>
- <script>
- $(function(){
- $('input').click(function(){
- $('input').attr('class','');
- $(this).attr('class','active');
- $('#box div').css('display','none');
- $('#box div').eq($(this).index()).css('display','block');
- });
- });
- </script>
- <div id="box">
- <input type="button" value="按钮一" class="active" />
- <input type="button" value="按钮二" />
- <input type="button" value="按钮三" />
- <div style="display: block;">111111111111111111</div>
- <div>222222222222222222</div>
- <div>333333333333333333</div>
- </div>
JavaScript css
jQuery
来源: http://www.qdfuns.com/article/50780/6bccc8ea7142be0db65f2e5a4a46e4f9.html