Program kVA to Watts Calculator Using JavaScript With HTML

Hello Friends Today, through this tutorial, I will tell you How to Create kVA to Watts calculator using JavaScript with HTML? Below is an example of a kVA to Watts calculator implemented using JavaScript with HTML:


<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>kVA to Watts Calculator</title>
body {
font-family: Arial, sans-serif;
margin: 20px;
label {
display: block;
margin-bottom: 8px;
input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
button:hover {
background-color: #45a049;
<h2>kVA to Watts Calculator</h2>
<label for="kva">Enter kVA:</label>
<input type="number" id="kva" placeholder="Enter kVA">
<button onclick="calculateWatts()">Calculate Watts</button>
<p id="result"></p>
function calculateWatts() {
// Get the kVA input value
const kva = parseFloat(document.getElementById('kva').value);
// Convert kVA to Watts
const watts = kva * 1000;
// Display the result
document.getElementById('result').innerHTML = `Watts: ${watts} W`;

This HTML file creates a simple form with an input field for entering kVA, a button to trigger the calculation, and a result paragraph to display the calculated watts. When the button is clicked, the `calculateWatts` function is called, which performs the calculation and updates the result on the page.