如何使用JQUERY选择或取消选择复选框 [英] How to select or deselect Check boxes using JQUERY

查看:82
本文介绍了如何使用JQUERY选择或取消选择复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个包含两个模板列(两个复选框)的数据网格.一个是列A,第二个是列B.当我单击全选"时,应同时选中两个项目模板复选框.当我单击SelectCoulmn A时,脚本应仅检查A列下的项目.

请通过JQuery帮助我.

Hi All,

I have a data grid which has two template columns (two check boxes).one is Column A,second is Column B. When I click Select All both the item templates check boxes should be checked. when I click SelectCoulmn A the script should check only the items which are under Column A.

Please help me through JQuery.

推荐答案

下面,我仅由于标题的误导性而提及选择"和焦点"提到选择或取消选择"的问题.此解决方案的相关部分是关于已检查"属性的.



对于控件,没有选择这样的概念.如果您要检查/取消检查,请执行以下操作:

Below, I mentioned "selection" and "focus" only due to misleading title of the question mentioning "select or unselect". The relevant part of this solution is about "checked" property.



For a control, there is no such concept as selection. If you mean check/uncheck, do this:


(" span>).prop(" true );
(".myCheckbox").prop("checked", true);


(" ).prop(" false );
(".myCheckbox").prop("checked", false);



如果您表示关注",请执行以下操作:



If you mean "focus", do this:


这篇关于如何使用JQUERY选择或取消选择复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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