How to Convert MPH to Knots Speed With HTML & Javascript?

Hello friends, today I will tell you through this tutorial how you can convert MPH to Knots Speed using javascript & html code.

This is the script code of javascript in which you have been told how you can convert MPH to KPH Speed.

<script>
function speedConverter(valNum) {
document.getElementById("outputKnots").innerHTML=valNum/1.150779;
}
</script>

This is the script code of html, in which you have been told the code to create the structure of the front.And also added the code of the script.

mph-to-knots-speed-converter.html

<!DOCTYPE html>
<html>
<title>MPH to Knots Speed Converter</title>
<body>
<h2>Speed Converter</h2>
<p>Type a value in the MPH field to convert the value to Knots:</p>
<p>
<label>MPH</label>
<input id="inputMPH" type="number" placeholder="MPH" oninput="speedConverter(this.value)" onchange="speedConverter(this.value)">
</p>
<p>Knots: <span id="outputKnots"></span></p>
<script>
function speedConverter(valNum) {
document.getElementById("outputKnots").innerHTML=valNum/1.150779;
}
</script>
</body>
</html>

Demo

MPH to Knots Speed Converter

Speed Converter

Type a value in the MPH field to convert the value to Knots:

Knots: