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

185
Vistas
Check if each() index 1 et index 2 has .prop( 'checked' )

How to check in a each() function if the first and the second matched element have the prop checked ?

$(document).on('click', '#submitBtn', function(e) {
        var $this = $(this),
            $checkboxItems = $('input:checkbox[name="checkbox-acceptance"]');
        
            
        $checkboxItems.each(function( index ){

            // if index 0 and index 1 have .prop( 'checked ' ) do stuff ..

        }       
})
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You don't want to use each for this. Just check the values with simple indexing:

if ($checkboxItems[0].checked && $checkboxItems[1].checked)
about 4 years ago · Juan Pablo Isaza Denunciar

0

I don't know of the existence of a each function, however if you need to check if the first two elements of an array are true I will go with @David Thomas solution

$checkboxItems.slice(0,2).every((el) => el.value);
about 4 years ago · Juan Pablo Isaza Denunciar
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