
button.onclick = function () {
const bounding = this.getBoundingClientRect();
select.style.top = (bounding.bottom + window.pageYOffset) + ‘px’;
select.style.left = (bounding.left + window.pageXOffset) + ‘px’;
select.style.width = bounding.width + ‘px’;
};
select.onclick = function (event) {
if (event.target.type == ‘radio’) {
this.hidePopover();
button.textContent = event.target.parentElement.textContent;
}
}