title: Disable List of Checkboxes with razor
body: <p>I have the following code to render rows of checkboxes</p>
  
  <pre><code>&lt;div id="notificationSettings"&gt;
      @for (var itr = 0; itr &lt; Model.Item1.Settings.Length; itr++)
      {
          &lt;div class="col-md-3 col-sm-12 form-group text-center"&gt;
              &lt;p&gt;@Model.Item1.Settings[itr].Name&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="col-md-3 col-sm-12 form-group text-center"&gt;
              &lt;input asp-for="Item1.Settings[itr].Notify" type="checkbox" style="margin-top: 10px;" /&gt;
              &lt;span asp-validation-for="Item1.Settings[itr].Notify" class="text-danger"&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="col-md-3 col-sm-12 form-group text-center"&gt;
              &lt;input asp-for="Item1.Settings[itr].ByEmail" type="checkbox" style="margin-top: 10px;"/&gt;
              &lt;span asp-validation-for="Item1.Settings[itr].ByEmail" class="text-danger"&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="col-md-3 col-sm-12 form-group text-center"&gt;
              &lt;input asp-for="Item1.Settings[itr].BySms" type="checkbox" style="margin-top: 10px;" /&gt;
              &lt;span asp-validation-for="Item1.Settings[itr].BySms" class="text-danger"&gt;&lt;/span&gt;
          &lt;/div&gt;
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>if I want to disable <code>ByEmail</code> and <code>BySms</code> checkboxes if <code>Notify</code> checkbox is unchecked then I can do something like this for a single set of checkbox :</p>
  
  <pre><code>document.getElementById("Item1_Settings_0__Notify").addEventListener('change', function() {
      if(this.checked) {
          document.getElementById("Item1_Settings_0__ByEmail").disabled = false;
          document.getElementById("Item1_Settings_0__BySms").disabled = false;
      } else {
          document.getElementById("Item1_Settings_0__ByEmail").disabled = true;
          document.getElementById("Item1_Settings_0__BySms").disabled = true;
      }
  });
  </code></pre>
  
  <p>My question is can I have one event handler which can handle any N number of checkboxes that only differ in <code>Id</code>. Or do I need N number of event handlers? If that be the case how can I register N number of event handlers with a for loop?</p>