Widget:Checkboxes grid
From ETHW
<style> .checkboxesSpan { display: grid; } </style> <script> var container = document.getElementsByClassName('checkboxesSpan')[0]; var labels = container.querySelectorAll('.checkboxLabel'); var labelsArray = Array.prototype.slice.call(labels);
labelsArray.sort(function(a, b) { var valueA = a.getElementsByTagName('input')[0].value.toUpperCase(); var valueB = b.getElementsByTagName('input')[0].value.toUpperCase();
if (valueA < valueB) { return -1; } if (valueA > valueB) { return 1; } return 0; });
// Append the sorted labels back to the container for (var i = 0; i < labelsArray.length; i++) { container.appendChild(labelsArray[i]); } </script>