本文介绍了复选框已选中和未选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将复选框的ID分配给当前已选中或未选中的变量,然后我想使用该变量来检查该ID的复选框是否选中或未选中.有人可以帮助我吗为此编码.到目前为止,我已经完成了以下代码.

I want to assign the ID of the checkbox to a variable that is been currently checked or unchecked.And then I want to use that variable I want to check whether the checbox of that ID is checked or unchecked.Can anyone help me coding for this. Till now I have done the followiing code.

$('.checkindustry').click(function () {

               var industryid = $(this).attr('id');
               alert(industryid);
                $('.checkproduct').click(function () {


                    if((industryid.attr('checked',false))&&(this.checked==false)){
                       $("." + $(this).attr("id")).find(".casestudies_contents").hide();
                    }



在上面的代码中没有得到输出.我知道我在"if"语句中有一个错误.请任何人为此提供替代解决方案.



In the above code am not getting the output. I know I have a mistake in the "if" statement. Please anyone provide an alternate solution for this.

推荐答案




这篇关于复选框已选中和未选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 17:05
查看更多