There are multiple objects in a div. I want to get the id of all those elements by their class. the number of elements can vary. I am doing it as
arr= $(".listitem #checkBox").hasClass('checkedItem').attr('id');
but it return only the first item
and if I use it as
arr= $(".listitem #checkBox").hasClass('checkedItem').map(function() {
return this.id;
}).get();
The error on console is Object true has no method 'map'
How I can get the Ids of all CheckedItems