I have got the below code to get the ID's of all selected items of a list. This code worked for me when I used it for other list but now when I am using for another list, this code is not getting the ID values.
$(".ms-listviewtable tbody[selectablerows == ''] tr").each(function (i, row) {
var $row = $(row);
if ($row.find("td[class*='ms-cellStyleNonEditable ms-vb-itmcbx ms-vb-imgFirstCell']").children('div.s4-itm-cbx.s4-itm-imgCbx').attr("aria-checked")=="true")
{
$selected = $row.find("td[class*='ms-cellStyleNonEditable ms-vb-itmcbx ms-vb-imgFirstCell']").children('div.s4-itm-cbx.s4-itm-imgCbx');
$Contextid = $selected.context.id;
$id = $Contextid.slice($Contextid.indexOf(',') + 1, $Contextid.lastIndexOf(','));
alert($id);
array[idCount]=$id;
idCount=idCount+1;
}
});
it shows error
Uncaught Error: Syntax error, unrecognized expression: .ms-listviewtable tbody[selectablerows == ''] tr
while debugging it only shows that the array value is 0. But if I select two items, it should show me the ID's of both the list items.
HTML Code- http://jsfiddle.net/mag4zj0v/
.ms-listviewtable tbody[selectablerows == ''] trselector. If it is still big then paste in jsbin or jsfiddle and then give the link here