jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jQuery实现菜单全选/不选大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_450_0@
@H_450_0@
<!DOCTYPE html>
<html lang="en">
<head>
    <Meta charset="UTF-8">
    <title>title</title>

    <style>
        table{
            margin:100px auto;
            border-spacing: 0;
            BACkground-color: #cccccc;
        }
        td{
            width: 100px;
            height: 50px;
            text-align: center;
            BACkground-color: #ff0;
        }

    </style>

</head>
<body>
    <table>
        <tr>
            <th><input type="checkBox"></th>
            <th>T1</th>
            <th>T2</th>
            <th>T3</th>
        </tr>

        <tr>
            <td><input type="checkBox"></td>
            <td>A1</td>
            <td>A2</td>
            <td>A3</td>
        </tr>

        <tr>
            <td><input type="checkBox"></td>
            <td>B1</td>
            <td>B2</td>
            <td>B3</td>
        </tr>

        <tr>
            <td><input type="checkBox"></td>
            <td>C1</td>
            <td>C2</td>
            <td>C3</td>
        </tr>

    </table>



    <script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>

    <script>
        $(function () {
            $("th>input").click(function () {
                $("tr input").prop("checked",$(this).prop("checked"));
            });

            $("td input").click(
                function () {
                    var allc = $("td input").length;
                    var checkedc = $("td input:checked").length;
                    if(allc == checkedC){
                        $("th>input").prop("checked",truE);
                    }
                    else{
                        $("th>input").prop("checked",falsE);
                    }
                }
            );

        });
    </script>



</body>
</html>
@H_450_0@

大佬总结

以上是大佬教程为你收集整理的jQuery实现菜单全选/不选全部内容,希望文章能够帮你解决jQuery实现菜单全选/不选所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:jquery全选实现菜单
猜你在找的jQuery相关文章
其他相关热搜词更多
phpJavaPython程序员load如何string使用参数jquery开发安装listlinuxiosandroid工具javascriptcap