<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" id="Username" />
<input type="button" id="tutorial" value="Click" onclick="repeatvalue()" />
<hr />
<label id="label"></label>
<script>
function repeatvalue() {
var txtName = document.getElementById("Username");
var lblName = document.getElementById("label");
if (label = "BE20R") {
result = '5layer';
} else {
result = '3layer';
}
lblName.innerHTML = result;
}
</script>
</body>
</html>
This is just my first steps in JS, so I want to ask for help. What I want is that depending on what value I put in the textbox, JS will show the converted value. For example, if I enter “BE20R” I want it to show me “5layers”, if I enter another value – “3layers”.