Update error handling

This commit is contained in:
LilyRose2798 2024-04-11 15:49:41 +10:00
parent 3d3a437ed2
commit 3db4702d93
1 changed files with 13 additions and 3 deletions

View File

@ -635,9 +635,19 @@
setJumpParam(undefined)
}
rangeInput.addEventListener("input", e => setJumpParam(rangeInput.value))
rangeInput.addEventListener("keydown", e => e.key === "Enter" && jump(rangeInput.value))
document.getElementById("range-button").addEventListener("click", () => jump(rangeInput.value))
const jumpToInput = () => {
try {
jump(rangeInput.value)
setJumpParam(rangeInput.value)
rangeInput.setCustomValidity("")
} catch (e) {
rangeInput.setCustomValidity(e.message)
}
rangeInput.reportValidity()
}
rangeInput.addEventListener("change", jumpToInput)
document.getElementById("range-button").addEventListener("click", jumpToInput)
</script>
</body>
</html>