This each statement is apart of a larger function which gets a children object(array) passed in. The issue im having is that im trying to compare array of values from the children object thats being passed in to a dom element on a page. In short how do i compare 2 arrays? If the values in passed array (Children) are not on the page or found in the dom then add the values to the DOM. If the values are already in the DOM then do nothing.
$.each(children,function(){
for (var i in children){
var the_child = children[i];
var the_child_check = $("#" + the_child.id, self.container);
}
if(self.container.children.length >=0){
self.container.tabs('add', '#' + the_child.id, the_child.label);
}else{
self.container.tabs('remove', '#' + the_child.id);
});
Once i understand how to implement this logic, then i should be able to incorporate this into its proper place into the function.
<div id="tabcontainer">
<ul id="tab1">
<li>tab 1</li>
</ul>
<ul id="tab2">
<li>tab 1</li>
</ul>
</div>
This is a basic example of how the html is constructed. each tab is dynamically generated based on the passed in array object (children)
In your example
This assumes you have set
selfsomewhere prior.