<span class="badge bg-danger" style="cursor: pointer;">150</span>
<span class="badge bg-danger" style="cursor: pointer;">250</span>
<span class="badge bg-danger" style="cursor: pointer;">350</span>
<span class="badge bg-danger" style="cursor: pointer;">450</span>
<span class="badge bg-danger" onclick="changeBadge(150, 200)" style="cursor: pointer;">150</span>
<span class="badge bg-danger" onclick="changeBadge(250, 255)" style="cursor: pointer;">250</span>
<span class="badge bg-danger" onclick="changeBadge(350, 235)" style="cursor: pointer;">350</span>
<span class="badge bg-danger" onclick="changeBadge(450, 225)" style="cursor: pointer;">450</span>
<script>
const changeBadge = (oldContent, newContent) => {
const badge = event.target
if (badge.classList.contains('bg-danger')) {
badge.classList.add('bg-success')
badge.classList.remove('bg-danger')
badge.innerHTML = newContent
} else {
badge.classList.remove('bg-success')
badge.classList.add('bg-danger')
badge.innerHTML = oldContent
}
}
</script>