简体   繁体   English

语义UI检查项不起作用

[英]Semantic UI checkall not working

I'm using SemanticUI and the checkall feature is not working. 我正在使用SemanticUI,并且checkall功能无法正常工作。 Here is my code 这是我的代码

jQuery('.ui.checkbox.selectAll').checkbox( {
    onChange: function(){
        formObj = this[0].form;
        checkall(formObj.SelectAllBox,formObj.UserID);
     }
});

And my checkall function is 我的checkall功能是

function checkall(c,t){
    for(i=0; i<t.length; i++) t[i].checked=c.checked;
}

HTML code HTML代码

<form name="form1" action="action.cfm" method="post">
    <div class="ui checkbox selectAll">
        <input type="checkbox" name="SelectAllBox" value="select_all" >
    </div>
    <div class="ui checkbox">
        <input type="checkbox" name="UserID" value="#UserID#">
    </div>
</form>

I've tried with many guidance and documentation but no luck. 我尝试了很多指导和文档,但是没有运气。 Thanks in advance for your help. 在此先感谢您的帮助。

You can try this : 您可以尝试以下方法:

$('input[name="SelectAllBox"]').change(function(){
    if($('input[name="SelectAllBox"]').attr('checked')=='checked'){
        $('input[name="UserID"]').attr('checked',true);
    }else{
        $('input[name="UserID"]').attr('checked',false);
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM