</> ConvertAtlas Developer Tools
Bootstrap 5 · Beginner

Upvote/Downvote Widget

A vote widget with up/down arrows and a live score.

Requires Bootstrap 5. Add the CDN tags below to your page (styles in <head>, scripts before </body>). The downloaded file already includes them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<div class="card border-0 shadow-sm" style="max-width:240px"><div class="card-body d-flex align-items-center gap-3"><div class="text-center"><button class="btn btn-sm btn-light" id="voUp">▲</button><div class="fw-bold" id="voScore">42</div><button class="btn btn-sm btn-light" id="voDown">▼</button></div><div class="small">Was this answer helpful to you?</div></div></div>
var s=42,el=document.getElementById("voScore"),v=0;document.getElementById("voUp").onclick=function(){s+=(v===1?-1:v===-1?2:1);v=v===1?0:1;el.textContent=s};document.getElementById("voDown").onclick=function(){s+=(v===-1?1:v===1?-2:-1);v=v===-1?0:-1;el.textContent=s};
Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.