在不重新加载页面的情况下计算所选复选框的数量? [英] Count the number of checkboxes selected without reloading the page?

查看:99
本文介绍了在不重新加载页面的情况下计算所选复选框的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进一步扩展这个问题



我目前有一个asp.net超链接用于全选 NumberOfCheckBoxes ),但我想要做的是添加另一个链接,可能只是一个标准的HTML超链接取消选中 >( NumberOfCheckedBoxes ),并更新 NumberOfCheckedBoxes 的值,因为复选框会被打勾,而不会重新加载页面。



我已经有了javascript来取消选中它们,但不计算它们并将其打印到屏幕上。



我不确定if JQuery是用这个或者标准的Javascript去的方式。



感谢您提供任何帮助。

解决方案

使用jQuery,您可以:

  $(input:checkbox:checked)。长度; 


I'm expanding further on this question.

I currently have an asp.net hyperlink for Select All (NumberOfCheckBoxes) which works, but what I'm looking to do is add another link, possibly just a standard HTML hyperlink for Uncheck Selected (NumberOfCheckedBoxes) and update the value of NumberOfCheckedBoxes as checkboxes are ticked, without reloading the page.

I have javascript already for unchecking them, but not counting them and printing it to screen.

I'm not sure if JQuery is the way to go with this or just standard Javascript.

Thanks in advance for any help.

解决方案

With jQuery you can:

$("input:checkbox:checked").length;

这篇关于在不重新加载页面的情况下计算所选复选框的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆