How to get innerHTML of each matched element

each, jquery

Solution

The first parameter of the `each` function should be an `array` or `object`, you are passing a string:

jQuery.each( collection, callback(indexInArray, valueOfElement) )

  $.each($('tr[class*=highlight-delete]'), function (index, item) {
          console.log(item.innerHTML);
  });

Problem

I have a lot of `<tr>` elements. Each important one is marked with a class name containing "highlight-delete". How can I iterate over the whole set of them, and write each of their `.innerHTML` to the console? I tried this but it failed ``` $.each('tr[class*=highlight-delete]', function (index, item) { console.log(item.innerHTML); }); ```

Original source