checkbox 全選或取消

Html: 點擊label 也能 checkthis

                   <div class="checkbox">
                        <input class="inputCheckbox" id="brandCheck_17" type="checkbox" value="">
                        <label for="brandCheck_17">Lenovo</label>
                    </div>spa

JQ:對象

        $(".CleanAll").on("click", function ()
        {
            $("input[id^='brandCheck_']").prop("checked", false);blog

            $("a[id^='btnApply_']").attr("style", "display:none;");
           
        });input

效果圖:string

其餘方法:io

 $("input[type='checkbox']").attr("checked",false);  只能取消初始已經 checked  的對象,不能全消後來checked.function

  $(this).prop("checked", false); 能夠 實現全選 或 取消class

相關文章
相關標籤/搜索