У меня есть ввод диапазона с компонентом реагирования, он только перемещает ползунок. не запускать функцию обратного вызова, которая там есть
Код: Выделить всё
onChangeКод: Выделить всё
const volumeResetHandler = async () => {
document.querySelector('input[type=range]').value = 0;//as mentioned by @mathias-s setSlv(0) should also be fine , my concern is the next line
document.querySelector('input[type=range]').dispatchEvent(new Event("change"));
}Код: Выделить всё
ResetЯ ожидал
Код: Выделить всё
volumeChangeHandlerКод: Выделить всё
document.querySelector('input[type=range]').value = 0;All solutions mentioned here suffers from same issue
this does for jquery, without looking at react or javscript,
it doesnt answer as it is for jquery , changing jquery to js like this in react isn't working
either.
So there must be something different going on with events in react.
Источник: https://stackoverflow.com/questions/781 ... nge-explic
Мобильная версия