mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
implement auto removal of selection
with this change only 1 emoji can be selected across all 4 categories
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
document.querySelectorAll('.emoji').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const category = button.getAttribute('data-category');
|
||||
if (category === 'Fleischgericht' || category === 'Vegetarisch' || category === 'Tagesgericht') {
|
||||
document.querySelectorAll('.emoji[data-category="Fleischgericht"], .emoji[data-category="Vegetarisch"], .emoji[data-category="Tagesgericht"]').forEach(btn => btn.classList.remove('selected'));
|
||||
if (category === 'Fleischgericht' || category === 'Vegetarisch' || category === 'Tagesgericht' || category === 'Tagessalat') {
|
||||
document.querySelectorAll('.emoji[data-category="Fleischgericht"], .emoji[data-category="Vegetarisch"], .emoji[data-category="Tagesgericht"], .emoji[data-category="Tagessalat"]').forEach(btn => btn.classList.remove('selected'));
|
||||
} else {
|
||||
document.querySelectorAll(`.emoji[data-category="${category}"]`).forEach(btn => btn.classList.remove('selected'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user