简体   繁体   中英

Javascript Range - onchange event

I have code for slider:

<input id="zoomvalue" class="slider" type="range" min="30" max="100" value="100" style="width: 150px;" />``

The problem is onchange event executed when releasing mouse, but I need onchange event for every slider move. May be I don't need input type="range" but slider made on pure javascript/jquery.

You can use oninput event

 var val = document.getElementById("val");
 <input id="zoomvalue" class="slider" type="range" min="30" max="100" value="100" style="width: 150px;" oninput="val.innerText = this.value"/> <span id="val"></span>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM