<form id="frmSongList">
<input type="checkbox" id="item-1" checked />
<input type="checkbox" id="item-3" checked />
<input type="checkbox" id="item-4" checked />
<input type="checkbox" id="item-13" checked />
<input type="checkbox" id="item-18" />
</form>
getIdList = function(){
var list = "";
if(!$("input[id^=item]:checked")[0]) {
return false;
}
else {
$("input[id^=item]:checked").each(function(){
list = list + ',' + $(this).attr("value");
});
// remove the first comma
return list.substring(1);
}
};
var list = getIdList(); // will return 1,3,4,13
Title:
jquery - list value/attribute of each element
Description:
<form id="frmSongList"> <input type="checkbox" id="item-1" checked /> <input type="checkbo...
...
Rating:
4