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 8412905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:47:45+00:00 2026-06-10T00:47:45+00:00

$(.globalTabs).each(function(){ var $globalTabs = $(this); var parent = $globalTabs.parent(‘form’); //initiate jQuery UI tabs $globalTabs.tabs();

  • 0
$(".globalTabs").each(function(){
    var $globalTabs = $(this);
    var parent = $globalTabs.parent('form');

    //initiate jQuery UI tabs
    $globalTabs.tabs();

    var ATBwidth = $globalTabs.parent().outerWidth();
    var tabsWidth = 0;

    //get total width of all li/tabs
    $(".globalTabs .ui-tabs-nav li").each(function() {
     tabsWidth += $(this).outerWidth();
    });


    if(tabsWidth >= ATBwidth){
       //doing something here
    }


});

which is breaking due to the nested .each – is there a simple way around this issue?

breaking = functionality after the second loop, which refers to $globalTabs is no longer triggering, because it is undefined.

Stupid mistake:

After the second loop, in this section I was referring to the selector twice.

So, with $(".globalTabs").each(function(){ this of course won’t work:
$globalTabs.find(".globalTabs .ui-tabs-nav li").hide();

Had nothing to do with the loops.

Thanks everyone for your help.

  • 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-10T00:47:47+00:00Added an answer on June 10, 2026 at 12:47 am

    Instead of using the value of this pass in the value from .each(index, value)

    $(".globalTabs").each(function(index, value){
        var $globalTabs = $(value);
        var parent = $globalTabs.parent('form');
    
        //initiate jQuery UI tabs
        $globalTabs.tabs();
    
        var ATBwidth = $globalTabs.parent().outerWidth();
        var tabsWidth = 0;
    
        //get total width of all li/tabs
        $(".globalTabs .ui-tabs-nav li").each(function(index, secondValue) {
         tabsWidth += $(secondValue).outerWidth();
        });
    
    
        if(tabsWidth >= ATBwidth){
           //doing something here
        }
    
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple .slideDown function: $globalTabs.find('.seeMore a').live(click, function(){ $globalTabs.find(.allTabs).slideDown('slow'); }); When a user
I have this code, but can't get it all working. I am trying to
Running my (rather complex) JavaScript/jQuery application in Google's Chrome browser, it would appear that
I need to iterate through array values and reference class objects.. like this.. how
This is a tricky problem which has had me scratching my head for a
I've been reading up examples on how to do this, trying to piece together
I know this does not sound Pythonic, but bear with me for a second.
(-> jQuery -> globalThis = @ $('#emailTypes').change -> globalThis.toggleEmailOptions() toggleEmailOptions = -> $('.emailTypeOptions').fadeOut 'fast',
im trying to call a lua function from C++ where function is in subtable
Clarification : As per some of the comments, I should clarify that this is

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.