Fix non-Blazor checkboxes and remove jQuery
parent
0f7124f205
commit
8a6c0b493b
|
@ -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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue