mercredi 4 janvier 2017

No return on$('input:checkbox').change(function() {? [duplicate]

This question already has an answer here:

I am testing a second solution that has been provided to me here, for checking and recording each check box that has been checked. First solution works like a charm but the second more efficient solution does not even run.

for (x in aL.results) {
  aLIds.push(aL.results[x].listing_id);
  aLTitles.push(aL.results[x].title);
  aLQuantities.push(aL.results[x].quantity);
  aLDescs.push(aL.results[x].description);
  aLTaxPaths.push(aL.results[x].Tax_path);
  aLTaxIds.push(aL.results[x].Tax_id);
  aLTags.push(aL.results[x].tags);
  aLUrls.push(aL.results[x].url);
  aLPrices.push(aL.results[x].price);
  aLViews.push(aL.results[x].views);
  aLHearts.push(aL.results[x].num_favorers);

  $('#tblListings').append(
    '<tr>' + '<td><input type="checkbox" name="updateListings[]" value=' + x + ' ></td>' + '<td>' + aLQuantities[x] + '</td>' + '<td>' + aLTitles[x] + '</td>' + '<td>' + aLPrices[x] + '</td>' + '<td>' + aLViews[x] + '</td>' + '<td>' + aLHearts[x] + '</td>' + '</tr>'
  );}

  $('input:checkbox').change(function() {
    alert('ah');
    var uLIndex = $('input:checkbox:checked').map(function() {
      return this.value;
    }).get();
    console.log(uLIndex);
  });




Aucun commentaire:

Enregistrer un commentaire