Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 第二张桌子总是隐藏的!为什么?_Jquery_Html_Asp.net Mvc - Fatal编程技术网

Jquery 第二张桌子总是隐藏的!为什么?

Jquery 第二张桌子总是隐藏的!为什么?,jquery,html,asp.net-mvc,Jquery,Html,Asp.net Mvc,我有一些单选按钮: <body> <div id="container"> <div> <input id="button" type="button" value="Show Type" /> <label> <input type="radio" name="table" value="form" checked="checked" style="width: 1

我有一些单选按钮:

<body>
<div id="container">
    <div>
        <input id="button" type="button" value="Show Type" />
        <label>
            <input type="radio" name="table" value="form" checked="checked" style="width: 10px" />
            Forms
        </label>
    </div>
    <div>
        <label>
            <input type="radio" name="table" value="entity" style="width: 10px" />
            Entity Types
        </label>
    </div>
    <div>
        <label>
            <input id="date" type="checkbox" name="date" value="date" style="width: 10px" />
            DATE
        </label>
    </div>
    <div id="forms" class="toHide">
        <table id="table_forms" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>English Name</th>
                    <th>Nickname</th>
                    <th>Created</th>
                    <th>Last Update</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
        <div class="add_delete_toolbar" />
    </div>

    <div id="entities" class="toHide">
    <table id="table_entity" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>

        <tfoot>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>

        <tbody>
            <tr>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
            <tr>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
            </tr>
            <tr>
                <td>Ashton Cox</td>
                <td>Junior Technical Author</td>
                <td>San Francisco</td>
                <td>66</td>
                <td>2009/01/12</td>
                <td>$86,000</td>
            </tr>
        </tbody>
    </table>
        <div class="add_delete_toolbar" />
    </div>
</div>
但是我的第二张桌子总是隐藏着,我不知道为什么!即使我选中/取消选中单选按钮。我尝试了不同的方法,但还是一无所获。请帮忙

您的“实体”分区位于“窗体”分区内。。。把它放在外面就行了:)

你没有关闭div#entities,因此div#entities就在它里面。将
放在
之前,它就会工作


演示:

交朋友;)从#forms div中提取你的#entities div。是否必须创建帐户才能创建JSFIDLE?此外,如果有,你应该使用else。我认为这是一个打字错误。他一定是忘了关表格部。这太快了。没想到
$("input:radio").change(function () {
            var test = $(this).val();
            if (test == 'entity') {
                $("#forms").hide();
                $("#entities").show();
                //$("#entities").attr("style", "display: block");
            }
            if (test == 'form') {
                $("#entities").hide();
                $("#forms").show();
                //$("#entities").attr("style", "display: none");
            }
        });