Home > Web Front-end > JS Tutorial > jquery counts the number of checkboxes selected by the user_jquery

jquery counts the number of checkboxes selected by the user_jquery

WBOY
Release: 2016-05-16 16:45:53
Original
1058 people have browsed it
复制代码 代码如下:





jquery test




one

two

three

four

five

six

seven






使用选择器得到所有被勾选的复选框元素的集合,然后通过判断元素的个数来得到用户勾选的个数。

有的时候,我们还对用户勾选复选框的个数做了限制,假设只能勾选三个,相应的代码是这样的:
复制代码 代码如下:





jquery test




one

two

three

four

five

six

seven




Related labels:
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