0

I need to disable checkboxes until the page load the data(products) and then enable them again, this is my code for loading data:

function loadCounter(filterCounter) {
    $.each(filterCounter.FilterCounter, function (key, value) {
        if (value.Count !== 0) {
            $("#filter .btn-groupl label :input[value='" + key + "']").parent("label").find("span.items-amount").text(value);
            $("filter .btn-group label :input[value='" + key + "']").parent("label").show();
        } else {
           ;
            $("filter .btn-group label :input[value='" + key + "']").parent("label").hide();
            
        }
    });
freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Dan
  • 1
  • Can you provide the html code as well – Mohammed Metwally Apr 14 '22 at 11:00
  • Given what you've provided as "loading data" doesn't have any async, `$(":checkbox").attr("disabled", true); loadCount(...); $(":checkbox").removeAttr("disabled")` - or put the two lines inside your loadCounter function. – freedomn-m Apr 14 '22 at 11:08
  • Does this answer your question: [how to enable/disable checkbox](https://stackoverflow.com/questions/2330209/jquery-checkbox-enable-disable) – freedomn-m Apr 14 '22 at 11:08

0 Answers0