A little to the code to detect button color, change pointer events.
Change :
//--SET BUTTON COLOUR
var buttonBackgroundColor = element.style.backgroundColor;
if (buttonBackgroundColor == "white") {
element.style.backgroundColor = "pink";
}else{
element.style.backgroundColor = "white";
}
To
//--SET BUTTON COLOUR
var GroupButtons = $("div.tag");
var buttonBackgroundColor = element.style.backgroundColor;
if (buttonBackgroundColor == "white" || buttonBackgroundColor == "grey") {
$.each(GroupButtons, function( index, value ) {
$(value).css("background-Color", "grey");
$(value).css("pointer-events", "none");
});
element.style.backgroundColor = "pink";
element.style.pointerEvents = "auto";
}else{
$.each(GroupButtons, function( index, value ) {
$(value).css("background-Color", "white");
$(value).css("pointer-events", "auto");
});
}