From ac3c07cbe5f7abebe09c3c1053cda0ad83327840 Mon Sep 17 00:00:00 2001 From: itsaygea Date: Sat, 24 Jan 2026 09:08:15 -0700 Subject: [PATCH] Fix clickable suggestions using addEventListener - Use data-operator-id attribute instead of inline onclick - Add event listeners after creating DOM elements - More reliable than global function approach --- js/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 3f1e3db..288bebb 100644 --- a/js/main.js +++ b/js/main.js @@ -633,7 +633,7 @@ ` : '
?
'; return ` -
+
${imgHtml}
${op ? op.name.toUpperCase() : id} ${op && op.free ? 'FREE' : ''}
@@ -643,6 +643,17 @@
`; }).join(''); + + // Add click listeners to suggestion items + list.querySelectorAll('.suggestion-item').forEach(item => { + item.addEventListener('click', () => { + const operatorId = item.dataset.operatorId; + if (!selectedTeam.includes(operatorId) && selectedTeam.length < 4) { + selectedTeam.push(operatorId); + updateTeamUI(); + } + }); + }); } }