Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!