Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Why does .on("click") fire but .on("scroll") doesn't for input element?

just putting together a quick range slider and I want the "progress bar" to move based on the value of the input field changing. The main control for this will be the scroll wheel but for some reason nothing is firing when I use .on("scroll"), just trying to figure out why. It took me a while to figure out I needed the onmousewheel="" attribute present to even be able to scroll through input values.

let slideInput = $("#slider-value");

$(document).ready(function() {
    slideInput.on("click", function() {
        const value = slideInput.val();
        console.log(value);
    });
    
    slideInput.on("scroll", function() {
    const value = slideInput.val();
    console.log(value);
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="number" id="slider-value" onmousewheel="" step=".1" min="2" max="10" placeholder="2.0" class="slider-value">

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The event is wheel.

let slideInput = $("#slider-value");

$(document).ready(function() {
    slideInput.on("click", function() {
        const value = slideInput.val();
        console.log(value);
    });
    
    slideInput.on("wheel", function() {
    const value = slideInput.val();
    console.log(value);
    });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="number" id="slider-value" onmousewheel="" step=".1" min="2" max="10" placeholder="2.0" class="slider-value">

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda