Please excuse my poor javascript knowledge.
I'm trying to return an array of ID values, e.g. [1,2,4], from DOM elements that are marked 'selected'.
<tr data-selected = 'true' data-id = '1'></tr>
<tr data-selected = 'true' data-id = '2'></tr>
<tr data-selected = 'false' data-id = '3'></tr>
<tr data-selected = 'true' data-id = '4'></tr>
My attempt at creating a coffeescript function for this
elems = $("tr[data-selected ='true']").data("id")
alert( elems )
This appears to only return the data-id value of the last element.
How do I create an array of all ID values?