“jQuery obtenga todas las casillas de verificación marcadas” Código de respuesta

jQuery obtenga todas las casillas de verificación marcadas

var values=[];
$('input[name="your-checkbox-name[]"]:checked').each(function () {
  values[values.length] = (this.checked ? $(this).val() : "");
});
Healthy Heron

Obtenga todos los valores Charretas de verificación JQuery

var selected = []; // New array
    $("#inputID input[type=checkbox]:checked").each(function () {
     selected.push(this.value);
});
gtamborero

jQuery obtenga casillas de verificación seleccionadas

var selected = [];
$('#checkboxes input:checked').each(function() {
    selected.push($(this).attr('name'));
});
Cruel Caribou

Seleccione todas las casillas de verificación jQuery

$('input:checkbox').prop('checked', true);
Spyder

jQuery validar toda la casilla de verificación marcada

<form id="form1" action="/controller/action" method="post">
   <input type="checkbox" name="box1" class="cBox" />
   <input type="checkbox" name="box2" class="cBox" />
   <input type="checkbox" name="box3" class="cBox" />
  <input type="submit" value="Submit" />
</form>
<script>
$('#form1').submit(function() {
   if ($('input:checkbox', this).length == $('input:checked', this).length ) {
            // everything's fine...
   } else {
            alert('Please tick all checkboxes!');
            return false;
   }
});
</script>
Ivan The Terrible

jQuery obtenga toda la casilla de verificación

$('.theClass:checkbox:checked')
Thoughtless Termite

Respuestas similares a “jQuery obtenga todas las casillas de verificación marcadas”

Preguntas similares a “jQuery obtenga todas las casillas de verificación marcadas”

Más respuestas relacionadas con “jQuery obtenga todas las casillas de verificación marcadas” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código