<!DOCTYPE html>
<html>
<body>
<form>
<input type="text" id="unit">
</form>
<br>
<button class="btn btn-sm btn-danger" id="confirm">Confirm</button>
<br>
<br>
<h4>
It is <span id="unitType">[?]</span>.
</h4>
<script type='text/javascript'>
document.getElementById("confirm").onclick = function() {
var unitInput = document.getElementById("unit").value;
var unitType = document.getElementById("unitType");
unitType.innerHTML = unitInput;
};
</script>
</body>
</html>