title: Display data if checkbox is checked
body: <p>I have array checkbox (category) and I want to display list of checkbox size if one of them is being checked. I have already made the JavaScript but it didn't work out. Here's my code:</p>
  <p>View</p>
  <pre><code>@foreach ($categories as $category)
  &lt;div class=&quot;mb-0 ml-2&quot;&gt;
   &lt;label class=&quot;mb-0&quot;&gt;
    &lt;input class=&quot;category mb-0&quot; id=&quot;category&quot; name=&quot;category[]&quot; type=&quot;checkbox&quot; value=&quot;{{ $category-&gt;id }}&quot; onChange=&quot;this.form.submit()&quot; 
    @if (in_array($category-&gt;id, $checkedCat)) checked @endif&gt;
    {{ $category-&gt;name }}
   &lt;/label&gt;
  &lt;/div&gt;
  @endforeach
  
  &lt;div id=&quot;size&quot; class=&quot;sizefilter&quot;&gt;
  //List of size checkbox
  &lt;/div&gt;
  </code></pre>
  <p>JavaScript</p>
  <pre><code>$(&quot;#category&quot;).on('change', function() {
   if($('input[name=&quot;category[]&quot;]:checked'))
   {
      $(&quot;.sizefilter&quot;).show();
   } else
   {
      $(&quot;.sizefilter&quot;).hide();
   }
  });
  </code></pre>