mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
let only 1 selection in the first 3 categories
This commit is contained in:
@@ -86,7 +86,11 @@ app.get('/', (req, res) => {
|
||||
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'));
|
||||
} else {
|
||||
document.querySelectorAll(\`.emoji[data-category="\${category}"]\`).forEach(btn => btn.classList.remove('selected'));
|
||||
}
|
||||
button.classList.add('selected');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user