<a href="javascript:void(0);" data-id="continent-1">Африка</a>
<a href="javascript:void(0);" data-id="continent-2">Азия</a>
<a href="javascript:void(0);" data-id="continent-3">Европа</a>
...
<input type="checkbox" id="continent-1">
<input type="checkbox" id="continent-2">
<input type="checkbox" id="continent-3">
document.addEventListener('click', function(e) {
const el = document.getElementById(e.target.dataset.id);
if (el) {
el.checked = !el.checked;
}
});
const buttons = document.querySelectorAll('[data-id]');
const onClick = e => checkboxes[e.target.dataset.id].checked ^= 1;
const checkboxes = Array
.from(buttons, n => n.dataset.id)
.reduce((acc, n) => (acc[n] = document.querySelector(`#${n}`), acc), {});
buttons.forEach(n => n.addEventListener('click', onClick));