document.addEventListener('DOMContentLoaded', function() {
const voteButtons = document.querySelectorAll('.vote-button');
voteButtons.forEach(function(button) {
button.addEventListener('click', function() {
const option = this.getAttribute('data-option');
const voteCount = document.querySelector(`.vote-count[data-option="${option}"]`);
let count = parseInt(voteCount.textContent);
// Check if the user has already voted for two options
if (count < 2) {
count++;
voteCount.textContent = count;
// You can add additional logic here, like sending the vote to a server
} else {
alert('You can only vote for two options.');
}
});
});
});