Как сформировать arraylist, используя следующий HTML-код
<div class="row mar-15" id="dvCategoryDetails"> <ul> <li class="search-choice" item="parent" itemname="Pharmacy College" workplace="8"><span workplace="8">Pharmacy College</span> <a class="tax-clear deletethis" item="parent" href="javascript:void(0)">cancel</a> </li> <li class="search-choice" item="child1" itemname="Assistant Professor " jobrole="368"><span jobrole="368">Assistant Professor </span> <a class="tax-clear deletethis" item="child1" href="javascript:void(0)">cancel</a> </li> <li class="search-choice" item="child2" itemname="Pharmaceutical Chemistry" subject="89"><span subject="89">Pharmaceutical Chemistry</span> <a class="tax-clear deletethis" item="child2" href="javascript:void(0)">cancel</a> </li> </ul> <br> <ul> <li class="search-choice" item="parent" itemname="Dental College" workplace="15"><span workplace="15">Dental College</span> <a class="tax-clear deletethis" item="parent" href="javascript:void(0)">cancel</a> </li> <li class="search-choice" item="child1" itemname="Associate Professor" jobrole="539"><span jobrole="539">Associate Professor</span> <a class="tax-clear deletethis" item="child1" href="javascript:void(0)">cancel</a> </li> <li class="search-choice" item="child2" itemname="Conservative Dentistry and Endodontics" subject="179"><span subject="179">Conservative Dentistry and Endodontics</span> <a class="tax-clear deletethis" item="child2" href="javascript:void(0)">cancel</a> </li> </ul> <br> </div>
Что я уже пробовал:
ВАР RoleSubjectdetails = [];
if ($("#dvCategoryDetails ul").длина >= 1) {.
..
....
...(Код)
}
RoleSubjectdetails должен иметь вывод типа:
0: {workplaceID: 8, subjectID: 89, RoleId: 368, RoleName: "Assistant Professor ", workplaceval: "Pharmacy College",subjectname: "Pharmaceutical Chemistry"} 1: {workplaceID: 15, subjectID: 179, RoleId: 539, RoleName: "Associate Professor", workplaceval: "Dental College",subjectname: "Endodontics"}
ZurdoDev
Что именно ты хочешь сделать?