0

I have an array $t with HTML elements:

Array

I need to execute a function on elements that have class row (2 elements).

Right now, I'm trying to filter elements with hasClass method but receive the following mistake:

hasClass(...).each is not a function

How can I iterate over the array and get elements with row class? Here is my code:

var $t = $(this).siblings('div');
console.log($t);

$t.hasClass("row").each(function(){
   ... 
})

UPDATE

I've changed a code a bit:

 var _t = $(this).siblings('div.row');
    console.log('t ' + _t);
    _t.each(function( index, value ){
        console.log('value ' + value);
        var checkboxes = value.find('input[type="checkbox"]');
        console.log(checkbox);

        checkboxes.trigger( "click" );
    })

Now, I'm receiving the following error:

value.find is not a function

Karen
  • 1,249
  • 4
  • 23
  • 46

1 Answers1

0

According to jquery doc hasClass will return only boolean. As mentioned in comments you should use $('div.row') selector instead

dganenco
  • 1,596
  • 1
  • 5
  • 16
  • In that case, I will select all `div.row` on the page I need `div.row` in a particular scope – Karen Jul 01 '19 at 10:00