Getting the Element ID of the "Selected" item in a list
I have a bunch of DIVs (not an <option> List) each of the class "SongListItem". For one of the DIVs at a time, I set a "Selected" attribute, so it sort of acts like a ListBox. So two rows in the list might look like:
<div id="Item1" class="SongListItem">Item 1 Text</div>
<div id="Item2" Selected="True" class="SongListItem">Item 2 Text</div>
Now I want to write a jQuery function which gets the ID of the SongListItem div that has Selected="True".
So far, I have tried:
var SongID= $('.SongListItem[selected="True"]').attr("id");
and
var SongID= $('.SongListItem[selected="True"]').get(0).attr("id");
in both cases, I get a "Object does not support this method."
What am I doing wrong here. Help always appreciated!
Alex