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

  • Home
  • SEARCH
  • 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 8458131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:59:42+00:00 2026-06-10T12:59:42+00:00

I am having some trouble figuring out how to get the number of elements

  • 0

I am having some trouble figuring out how to get the number of elements that match a value. Here is my rough code:

var $numElements = $('#casestudy-content article').length;
console.log($numElements);
$('#casestudy-content article').each(function() {
    var $leftElements = $(this).position().left;
    if ( $leftElements === 0 ) {
        console.log($leftElements);
    }
});

So I can count how many elements there are in total. I can find the elements that have a position left of 0… but I do not know how to count those elements that return 0. I need to find how many elements = left: 0; and multiply that by a number. Any suggestions?

Thanks,

  • 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-10T12:59:44+00:00Added an answer on June 10, 2026 at 12:59 pm

    You can use filter method.

    var len = $('#casestudy-content article').filter(function() {
                   return $(this).position().left === 0
              }).length
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble figuring out how to add elements to a parent object
I'm having some trouble figuring out to call methods that I have in other
I'm having some trouble figuring this out. I have an unordered list menu that
I have been having some trouble figuring out how exactly I get a process's
I'm having some trouble figuring out why I can only get the children of
I'm a beginner with Haskell and am having trouble figuring out some code. What
I'm having some trouble figuring out how to get Ember's select view to update
I'm having some trouble figuring something out that should be quite easy and straight
I am having some trouble figuring out why I am only receiving one reply
I'm having some trouble figuring out how to make a reference to a subroutine

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.