JSFiddle - React, Tailwind, and code Playground
by Shirly Manor
HTML
<head>
<title>ROI Calculator</title>
<script src="script.js"></script>
<script>
function sumInputs5() {
var sum = 0;
var fol = Number(document.getElementById('fol').value);
var cur = Number(document.getElementById('cur').value);
var ree = Number(document.getElementById('ree').value);
var avg = Number(document.getElementById('avg').value);
var tot = document.getElementById('tot');
sum = ((fol * ree/100 * avg)-(fol * cur/100 *avg ))
tot.textContent = (sum).toLocaleString()
sum = 0
}
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Compact Form</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 400px;
margin: 0 auto;
}
.arr {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.arr p {
flex: 1;
margin: 0;
}
.arr input[type="number"] {
width: 150px;
text-align: right;
}
.arr img {
width: 20px;
margin-right: 5px;
}
#calculate {
width: 100%;
background-color: #007BFF;
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
}
#calculate:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<div class="inputs">
<div class="arr">
<p>Followers</p>
<input type="number" id="fol" value="500000">
</div>
<div class="arr">
<p>Current image reach rate</p>
<input type="number" id="cur" value="9"> %
</div>
<div class="arr">
<p>Reels reach rate</p>
...