Update error handling
This commit is contained in:
parent
3d3a437ed2
commit
3db4702d93
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue