<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="utf-8" />
<title>Zalamování</title>
<style>
input[type=text] {
width: 95%;
}
#vystup {
white-space: nowrap;
}
</style>
<script>
function zalamText(){
// vstup
const nezalomenyText = document.getElementById('vstup').value
const delkaRadku = parseInt(document.getElementById('delka-radku').value)
// todo: udelej zmeny
let zalomenyText = nezalomenyText
zalomenyText = zalomenyText.replaceAll(" ","<br>")
// vystup
document.getElementById('vystup').innerHTML = zalomenyText
}
</script>
</head>
<body>
<p><input type="text" id="vstup"></p>
<p><input type="number" id="delka-radku" value="20"></p>
<p><div id="vystup">
</div></p>
<p><input type="submit" onclick="zalamText()"></p>
</body>
</html>