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

110
Vistas
How show checkbox checked data-img on list

I have this field

<input class="red-heart-checkbox " name="photo[]" type="checkbox" value="<?php echo $id; ?>" id="<?php echo $id; ?>" data-img="<?php echo $imageURL; ?>"/>

And I would like to make a list of image with url image from the data-img checked but I only have values with this code :

<script>
            $(function() {
        var masterCheck = $("#masterCheck");
        var listCheckItems = $("#devel-generate-content-form :checkbox");

        masterCheck.on("click", function() {
          var isMasterChecked = $(this).is(":checked");
          listCheckItems.prop("checked", isMasterChecked);
          getSelectedItems();
        });

        listCheckItems.on("change", function() {
          var totalItems = listCheckItems.length;
          var checkedItems = listCheckItems.filter(":checked").length;

          if (totalItems == checkedItems) {
            masterCheck.prop("indeterminate", false);
            masterCheck.prop("checked", true);
          }
          else if (checkedItems > 0 && checkedItems < totalItems) {
            masterCheck.prop("indeterminate", true);
          }
          else {
            masterCheck.prop("indeterminate", false);
            masterCheck.prop("checked", false);
          }
          getSelectedItems();
        });

        function getSelectedItems() {
          var getCheckedValues = [];
          getCheckedValues = [];
            
          listCheckItems.filter(":checked").each(function() {
            getCheckedValues.push($(this).val());
          });
            
          $("#selected-values").html(JSON.stringify(getCheckedValues));
        }
      });
        </script>
        

My result is on :

<li class="list-group-item" id="selected-values"></li>

And looks like this :

result of script

Is it possible to have url image instead of the value , or use the result with de database to have url image ?

Thanks a lot !

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Two solutions in my opinion,

  1. The one you already suggested, i.e. use a db call
  2. try passing imageURL in 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