Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
jquery nice number spinner how to let work step number js only for certain class

I have this nice number spinner from https://www.jqueryscript.net/form/Number-Input-Spinner-jQuery-Nice-Number.html. and I have this script to let the input step 0.1 digit at a time but I want to let it work only for a certain class. how can I do? code: query in head

<link rel="stylesheet" href="js/jquery.nice-number.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  
    <script src="js/jquery.nice-number.js"></script>

body:

<input type="number" value="1.0" name="qty" step="0.1" max="99999" min="0.1" class="ist">
    <input type="number" step="1">
    <script>


        $(function () {

            $('input[type="number"]').niceNumber({
                if($('.ist')) {
                onDecrement: ($el, newValue, settings) => {
                    $el.val(Math.round((newValue + 0.9) * 100) / 100);
                    console.log($el.val())
                },
                    onIncrement: ($el, newValue, settings) => {
                        //console.log($el.val())
                        $el.val(Math.round((newValue - 0.9) * 100) / 100);
                        console.log($el.val())
                    }
            }
        });

        });


    </script>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda