# How to Convert Hex to Decimal Using JavaScript HTML?

Hello Friends Today, through this tutorial, I will tell you How to Hex to Decimal Convert Using JavaScript Without Submit Button? You can create a simple Hex to Decimal converter using JavaScript with HTML without a submit button by using the `input` event to trigger the conversion as the user types. Here’s an example:

index.html

```<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hex to Decimal Converter</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
label {
display: block;
margin-bottom: 8px;
}
input {
width: 100%;
margin-bottom: 16px;
box-sizing: border-box;
}
p {
font-weight: bold;
color: #333;
}
</style>
<body>
<h2>Hex to Decimal Converter</h2>
<p id="decimalResult"></p>

<script>
// Function to convert hex to decimal
function hexToDecimal(hex) {
return parseInt(hex, 16);
}

// Get the input element
const hexInput = document.getElementById('hexInput');

// Add an input event listener to trigger conversion as the user types
const hexValue = hexInput.value.trim();

// Check if the input is a valid hex value
if (/^[0-9A-Fa-f]+\$/.test(hexValue)) {
const decimalValue = hexToDecimal(hexValue.toUpperCase());
document.getElementById('decimalResult').textContent = `Decimal: \${decimalValue}`;
} else {