Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:41:20+00:00 2026-06-17T09:41:20+00:00

This each statement is apart of a larger function which gets a children object(array)

  • 0

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)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:41:20+00:00Added an answer on June 17, 2026 at 9:41 am

    In your example

    This assumes you have set self somewhere prior.

    // i gets index, val receives the item of the current iteration
    $.each(children, function(i, val) {
        // code
        if (self.container.find(val)) {
           // item exists in dom
        } else {
           // item does not exist in dom
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a notification area that will show alerts. return this.each(function() {
I'm writing a jQuery plugin , which similar to this, $(this).each(function(){ $el = $(this).find('.el')
I have a code snippet like this myhash.each_value{|subhash| (subhash['key]'.each {|subsubhash| statement that modifies the
In my xslt template I am having a for-each statement. In that for-each I
Here in this code: $('#doneItem').click(function(){ $(this).each(function(index){ var item = 'personal' + index; alert(item); localStorage.removeItem('personal'
I used a code: jQuery.fn.MyFunction = function(){ return this.each(function() { attributes = test; return
Take the following example plugin: (function($) { $.fn.alertOnClick = function(text) { return this.each(function(){ $(this).click(alert(text));
Consider the following base code: (function($) { $.fn.myPlugin = function(settings) { return this.each(function() {
I have a submenu that list departments. Behind this each department have an action
Given the following jquery code.. jQuery.fn.sliding = function () { return this.each(function () {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.