Home >Web Front-end >JS Tutorial >jQuery operation checkbox selection (list/table)_jquery

jQuery operation checkbox selection (list/table)_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:38:02894browse

1. Checkbox list selection

Rendering:

" -//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


$("#btnCheckAll").bind("click", function () { $("[name = chkItem]:checkbox").attr("checked", true);
});
// Select none
$("#btnCheckNone").bind("click", function () {
$("[name = chkItem]:checkbox"). attr("checked", false);
});
// Reverse selection
$("#btnCheckReverse").bind("click", function () {
$("[name = chkItem]:checkbox").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
});
// Select none
$("#btnSubmit").bind("click", function () {
var result = new Array();
$(" [name = chkItem]:checkbox").each(function () {
if ($(this).is(":checked")) {
result.push($(this).attr(" value"));
}
});
alert(result.join(","));
});
});




Today's topic
Visual Focus
Finance
Car
Technology
Real Estate
Travel












2. Checkbox table selects


Rendering:


Code:



Copy code The code is as follows:



















































分类名称



今日话题



视觉焦点



财经



汽车



科技



房产



旅游



Statement:
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