I have a ul menu from which I want to retireve certain information
<ul id="form_builder_sortable" class="sortable rightDiv session1"> <li class="draggable ui-state-highlight item id10">Maths<button class="delbtn">&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)).Here:split("×");
var sessionData = []; for (var i = 0; i < session.length; i++) { var s = {subjectOrder:i, subjectID:subs[session[i]]}; sessionData.push(s); } var ses = {sessionNo:index,sessionData:sessionData}; sessions.push(ses); }); }
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?