[jQuery] Can't select checked checkboxes
I don't get it
In my page I have several checkboxes like this one:
<input id="item-8" type="checkbox"/>
This is my Jquery code:
function ShowSelected()
{
var ids;
$("[id^='item-'][checked]").each(function(){ids = ids +"," +$
(this).attr("id").split('-')[1];});
alert(ids);
}
This should give me a list of ids,right?
I get nothing, an empty alert
can anyone help?
Thanks