JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phone Number Slider</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="ad"><a href="https://rubi.me/phone-number-slider/">rubi.me</a></div>
<div class="slider-container">
<input
type="range"
id="phone-slider"
min="0"
max="9999999999"
step="1"
value="0"
oninput="updatePhoneNumber(this.value)">
<div class="number-display">
<span id="phone-number">0000000000</span>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
CSS
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f9f9f9;
}
.slider-container {
text-align: center;
background: #ffffff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
width: 300px;
}
input[type="range"] {
width: 100%;
margin: 20px 0;
-webkit-appearance: none;
background: #ddd;
height: 5px;
border-radius: 5px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 20px;
height: 20px;
background: #007bff;
border-radius: 50%;
cursor: pointer;
}
.number-display {
font-size: 1.5em;
color: #333;
font-weight: bold;
}
.ad{
margin-top:350px
}
JavaScript
function updatePhoneNumber(value) {
const phoneNumberDisplay = document.getElementById("phone-number")
phoneNumberDisplay.textContent = value.padStart(10, "0")
}