JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<form action="something.html" id="subit">
<label for="first">Post nr </label><input type="text" id="postnr"/>
<label for="first">Kvm </label><input type="text" id="first"/>
</form>
<p>Pris</p><div id="result">1500</div>
</div>
JavaScript
$(document).ready(function() {
var post = $("#postnr");
var postval = $("#postnr").val();
if (postval == 100){
var textboxes = $("#first");
textboxes.on("keyup", function() {
var amt = 1500;
textboxes.each(function() {
amt += +$(this).val();
});
$("#result").html(amt);
});
};
else {
$("#result").html("fan");
};
});