JSFiddle - React, Tailwind, and code Playground

by Ratanak Serey

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" class="k-checkbox" id="chkInvoiceStatusActive" asp-for="InvoiceStatus" data-rel="invoiceDetails" />
<label>Invoice Status</label>
<div id="invoiceDetails" class="invoice status hidden">
  Invoice Status: Good
</div>

CSS

.invoice.status {
  padding: 0.5em;
}

.hidden {
  display: none;
}

JavaScript

$(function() {
  $("input[type='checkbox']").each(function(i, el) {
    var chk = $(el);
    if (chk.is(":checked")) {
      $("#" + chk.data("rel")).removeClass("hidden");
    }
  });

  $("input[type='checkbox']").change(function(e) {
    if ($(this).is(":checked")) {
      $("#" + $(this).data("rel")).removeClass("hidden");
    } else {
      $("#" + $(this).data("rel")).addClass("hidden");
    }
  });
});