I am currently facing an issue while navigating through an unordered list and fetching list items.
foreach (MyTypeObject s in result)
{
oList.Clear();
{
oList.AppendFormat("<ul id='OuteroListItems'>");
oList.AppendFormat("<li>");
oList.AppendFormat("<ul id='oListItems'>");
oList.AppendFormat("<li>" + s.Name + "</li>");
oList.AppendFormat("<li>" + s.NameDesc + "</li>");
oList.AppendFormat("<li>" + s.StartDate + "</li>");
oList.AppendFormat("<li>" + s.EndDate + "</li>");
oList.AppendFormat("</ul>");
oList.AppendFormat("</li>");
oList.AppendFormat("</ul>");
sb.Append(oList);
}
Alright, I am dealing with a scenario where there is a list of items within another unordered list that contains additional items.
My objective is to retrieve the start date for each item.
For instance, if there are 3 unordered lists inside 'OuteroListItems', I aim to identify all 3 StartDates from these lists and mark them red in 'oListItems'.
I attempted this process but it only marks the first element of the outer list as red in the 3rd inner list element.
$("ul#OuteroListItems li").each(function(){
$("ul#oListItems li:eq(2)").css("color", "red");
});