Visual Studio Code
- 1 ответ
- 0 вопросов
1
Вклад в тег
const farea = document.querySelector('#farea')
const bubble = document.querySelector('.bubble')
const rangeVal = document.querySelector('#r');
const rangeMin = rangeVal.getAttribute('min')
const rangeMax = rangeVal.getAttribute('max')
farea.addEventListener('input', () => {
if (farea.value.match(/[^0-9\.]/g)) {
farea.value = this.value.replace(/[^0-9\.]/g, '')
}
const inputValue = farea.value
const toOut = Math.max(rangeMin, Math.min(rangeMax, inputValue))
rangeVal.value = toOut
bubble.innerHTML = toOut
})