Free html code for percent to decimal convetor online
We will try to give you a new code for every day .
Here is a code for percent to decimal convertor HTML code
<html lang="en">
<head>
<meta charset="UTF-8"></meta>
<meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
<title>Percentage to Decimal Converter</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
</style>
</head>
<body>
<h2>Percentage to Decimal Converter</h2>
<label for="percentInput">Enter Percentage (e.g., 50%):</label>
<input id="percentInput" placeholder="Enter percentage" type="text" />
<button onclick="convertPercentToDecimal()">Convert</button>
<p id="result"></p>
<script>
function convertPercentToDecimal() {
// Get the percentage input value
var percentInput = document.getElementById("percentInput").value;
// Remove the percentage symbol if present
percentInput = percentInput.replace('%', '');
// Convert percentage to decimal
var decimal = parseFloat(percentInput) / 100;
// Display the result
document.getElementById("result").innerHTML = "Decimal: " + decimal;
}
</script>
</body>
</html>
Comments
Post a Comment