I need a function to be called when the slider knob has been released.
onchange
changes the value while I'm changing it. Is there a solution for this like
<input type="range" min="0" max="1000" onrelease="callfunction()">
I need a function to be called when the slider knob has been released.
onchange
changes the value while I'm changing it. Is there a solution for this like
<input type="range" min="0" max="1000" onrelease="callfunction()">
Use the mouseup
event on desktop browsers and the touchend
event on mobile phones for handling this user interaction.
<input type="range" min="0" max="1"
onmouseup="callfunction()"
ontouchend="callfunction()">
I would recommend to check caniuse.com for browser support.
Known issues (as of 2019-03-25):
input type=range
is different in different browsers (and still really experimental). Just moving the slider causes change
events in IE, input
events in Firefox, and both of them in Chrome! But releasing it triggers onmouseup
in all of them. This might not work in implementations that do not use a mouse in this context. –
Reflectance © 2022 - 2024 — McMap. All rights reserved.
step
attribute, e.g.step="0.01"
(or a differentmax
attribute). – Reflectancemin
andmax
. – Reflectance