在下拉列表中的树状结构中填充许多复选框 [英] Populating Many checkboxes in tree structure inside Dropdown

查看:89
本文介绍了在下拉列表中的树状结构中填充许多复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人这里是复选框,以树状结构显示.我需要将其显示在下拉菜单中.

Guys Here is the checkboxes, where it displays in tree structure. I need it to be displayed inside the dropdown.

<html>

    <head>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

        <script type="text/javascript">

            $(document).ready(function(){

                $('.team').on('click',function(){
                    if($(this).is(':checked')){
                        $(this).next().next().show();
                    }else{
                        $(this).next().next().hide();
                    }
                });
            });


        </script>

    </head>

    <body>

        <form name="FootballClubs">

            <input type="checkbox" class="team" value="RealMadrid"/>Real Madrid<br />
            <div style="padding:10px 10px 10px 15px;display:none;">     
                <input type="checkbox" class="player" value="CR"/>Cristiano Ronaldo<br />
                <input type="checkbox" class="player" value="SA"/>Shabi Alanso<br />
                <input type="checkbox" class="player" value="IC"/>Iker Casillias<br />
            </div>  
            <input type="checkbox" class="team" value="ManCity"/>Man City<br /> 
            <div style="padding:10px 10px 10px 15px;display:none;">
                <input type="checkbox" class="player" value="SA"/>Sergio Aguero<br />
                <input type="checkbox" class="player" value="SM"/>Super Mario<br />
            </div>
        </form>

    </body>

</html>

我正在尝试在下拉列表中填充.帮我.

I am trying to populate inside a dropdown. Help me.

先谢谢了!!

推荐答案

查看jquery UI小部件 jSTree

Look at jquery UI widget and jSTree

这篇关于在下拉列表中的树状结构中填充许多复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆