Extract id value from css class to javascript variable - Essay Example

I have a ul menu from which I want to retireve certain information

We Will Write A Custom Essay Sample On
ANY TOPIC SPECIFICALLY
FOR YOU

For Only $13.90/page


order now

<ul id=”form_builder_sortable” class=”sortable rightDiv session1″>
<li class=”draggable ui-state-highlight item id10″>Maths<button class=”delbtn”>&amp;times</button></li>
</ul>

I have a function in javascript:

function getSessionDatas(){
var sessions = [];
$(‘.rightDiv’).each(function( index ) {
var session = $.trim($(this).text().slice(0,-1)).split(“×”);
var sessionData = [];
for (var i = 0; i &lt; session.length; i++) {
var s = {subjectOrder:i, subjectID:subs[session[i]]};
sessionData.push(s);
}
var ses = {sessionNo:index,sessionData:sessionData};
sessions.push(ses);
});
}

Here:

var s = {subjectOrder:i, subjectID:<get id here>};

I want to assign the subject id according to the class of the <li> item, in this case in the class there is an id10. How can i assign the subjectID to 10 in this case?