Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the event that input range triggers?

I am creating a simple volume changer for my website and I am using change event to trigger the setVolume function but it is triggered only when I release my mouse, how to make the event triggered before I release my mouse?

for example, when I swipe to the half the volume is changed to 0.5 before I need to release my mouse.

HTML :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<input type="range" min="0" max="100" value="100" class="slider" id="volume_slider" onchange="setVolume(this)">

>Solution :

MDN says there is the change and the input event.

Change is triggered, when it is commited, i guess mouseup

The other one is triggered when the value changes

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event

Note: The input event is fired every time the value of the element changes. This is unlike the change event, which only fires when the value is committed, such as by pressing the enter key, selecting a value from a list of options, and the like.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading