Home > Web Front-end > HTML Tutorial > How to implement select all checkbox in C# MVC4. _html/css_WEB-ITnose

How to implement select all checkbox in C# MVC4. _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:21:49
Original
1248 people have browsed it

mvc4

C# MVC4 How to implement select all checkbox.

Reply to discussion (solution)

        $("#chkAll").click(function () {            if (this.checked) {                $("input[name='chkId']").each(function () { this.checked = true; });            }            else {                $("input[name='chkId']").each(function () { this.checked = false; });            }        });
Copy after login


   <input type="checkbox" id="chkAll" />全选   <input type="checkbox" name="chkId" value="id1" />   <input type="checkbox" name="chkId" value="id2" />
Copy after login

        window.onload = function () {            $("#chkAll").click(function () {                $("input[name='chkId']").attr("checked", this.checked);            });        }
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template