Fix non-Blazor checkboxes and remove jQuery

dhcp-server
Pat Hartl 2023-09-12 18:02:30 -05:00
parent 0f7124f205
commit 8a6c0b493b
1 changed files with 15 additions and 10 deletions

View File

@ -29,24 +29,29 @@
</main> </main>
</section> </section>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/antv/g2plot/dist/g2plot.js"></script> <script src="~/lib/antv/g2plot/dist/g2plot.js"></script>
<script src="~/_content/AntDesign/js/ant-design-blazor.js"></script> <script src="~/_content/AntDesign/js/ant-design-blazor.js"></script>
<script src="~/_content/AntDesign.Charts/ant-design-charts-blazor.js"></script> <script src="~/_content/AntDesign.Charts/ant-design-charts-blazor.js"></script>
<script src="~/js/site.js"></script> <script src="~/js/site.js"></script>
<script> <script>
$('input[type="checkbox"]').on('change', function() { var checkboxes = document.querySelectorAll('.ant-checkbox-input');
var checked = $(this).prop('checked');
if (checked) { function handleCheckboxChange(event) {
$(this).parents('.ant-checkbox-wrapper').addClass('ant-checkbox-wrapper-checked'); var checkbox = event.target;
$(this).parents('.ant-checkbox').addClass('ant-checkbox-checked'); var parentWrapper = checkbox.closest('.ant-checkbox-wrapper');
}
else { if (checkbox.checked) {
$(this).parents('.ant-checkbox-wrapper').removeClass('ant-checkbox-wrapper-checked'); parentWrapper.classList.add('ant-checkbox-wrapper-checked');
$(this).parents('.ant-checkbox').removeClass('ant-checkbox-checked'); parentWrapper.querySelector('.ant-checkbox').classList.add('ant-checkbox-checked');
} else {
parentWrapper.classList.remove('ant-checkbox-wrapper-checked');
parentWrapper.querySelector('.ant-checkbox').classList.remove('ant-checkbox-checked');
} }
}
checkboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', handleCheckboxChange);
}); });
</script> </script>