I would use something like the following:
<ul id="items-list">
<li id='member-43'>Monica</li>
<li id='member-47'>Henrik</li>
<li id='member-77'>Eric</li>
</ul>
then:
$('#items-list li').each(function() {
var id = $(this).attr('id').split('-')[1];
});
It was pointed out in the comments that as of HTML5 it's perfectly valid to start an id
attribute with a number, but I'd still give preference to this method, especially if there are to be multiple lists on a page from different DB tables (id
s still need to be unique). An id
of 43
has no meaning to anyone, but member-43
is much more clear.