public void RefreshTabHeader(jQuery tabElement) { jQuery pages = tabElement.Children(".page"); jQuery header = tabElement.Children("header"); header.Remove("a"); pages.Each((pid, page) => { var jpage = new jQuery(page); header.Append($"<a href='' data-pageid='{jpage.Attr("data-pageid")}'>{jpage.Attr("data-page-title")}</a>"); }); jQuery active = tabElement.Children(".page.active"); if (active.Length == 0) { active = pages.First(); } ShowTab(tabElement, active); }