Full Source Code — Star Rating with Emoji Feedback

<!DOCTYPE html>
<html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Star Rating with Emoji Feedback - Coodeverse</title> <style> body { font-family: Arial, sans-serif; background: #111; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; margin: 0; } .stars { display: flex; cursor: pointer; font-size: 2.5rem; color: #444; margin-bottom: 20px; } .stars .star.active { color: gold; text-shadow: 0 0 15px gold; } .emoji { font-size: 5rem; margin: 20px 0; transition: all 0.3s ease-in-out; text-shadow: 0 0 15px #fff; } button { padding: 10px 20px; border: none; border-radius: 25px; background: #ff4747; color: white; cursor: pointer; font-size: 1rem; font-weight: bold; letter-spacing: 1px; transition: 0.3s ease-in-out; } button:hover { background: #ff2222; transform: scale(1.05); } </style>
</head>
<body> <div class="stars"> <span class="star" data-value="1">★</span> <span class="star" data-value="2">★</span> <span class="star" data-value="3">★</span> <span class="star" data-value="4">★</span> <span class="star" data-value="5">★</span> </div> <div class="emoji" id="emoji">Neutral</div> <button id="reset">RESET</button> <script> const stars = document.querySelectorAll(".star"); const emoji = document.getElementById("emoji"); const resetBtn = document.getElementById("reset"); let rating = 0; const emojis = ["Sad", "Frowning", "Neutral", "Smile", "Grinning"]; stars.forEach(star => { star.addEventListener("click", () => { rating = star.getAttribute("data-value"); updateStars(); emoji.textContent = emojis[rating - 1]; }); }); function updateStars() { stars.forEach(star => { star.classList.remove("active"); if (star.getAttribute("data-value") <= rating) { star.classList.add("active"); } }); } resetBtn.addEventListener("click", () => { rating = 0; updateStars(); emoji.textContent = "Neutral"; }); </script>
</body>
</html>