Home » Jquery » jquery – Get id of element in Isotope filtered items

jquery – Get id of element in Isotope filtered items

Posted by: admin February 22, 2020 Leave a comment

Questions:

I am trying to get the id attribute of an isotope element after filtering. This is the structure of said element:

<div id="312" class="isotope-item">

Let’s say this element is the 14th element of the array after filtering. What I want is to get “312”. That’s what I tried:

var elems = $grid.isotope('getFilteredItemElements');
alert(elems[14].first().attr("data-id"));

I tried variations of that but so far no luck. Thanks to whoever can help!

How to&Answer: