Published
Edited
Jun 21, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
function limitCheckboxes(limit, widget) {
widget.addEventListener('change', function onchange() {
const checked = widget.querySelectorAll('input[type="checkbox"]:checked');
const unchecked = widget.querySelectorAll('input[type="checkbox"]:not(:checked)');
for(const n of unchecked) n.disabled = checked.length >= limit;
});
return widget;
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more