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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:27:53+00:00 2026-05-30T17:27:53+00:00

An array returns a series of .box ‘s, one of which has an additional

  • 0

An array returns a series of .box‘s, one of which has an additional class of .logo How do I apply a function to integers in the array ignoring that one element without removing it? (can’t use .splice because I need .logo to stay in the array for other purposes)

So I need to say: IF .logo is within index 0-2 of the array THEN ignore it and add the next integer

Here’s what I’m currently using. It’s verbose and ugly:

    var b       = $('.box'),      //Box
        boxImgs = $('.box img');  // Box element images

        if (b.eq(0).hasClass('logo')) {

            boxImgs.eq(1).wrap('<a href="http://player.vimeo.com/video/34969501" />');
            boxImgs.eq(2).wrap('<a href="http://player.vimeo.com/video/35036115" />');
            boxImgs.eq(3).wrap('<a href="http://player.vimeo.com/video/35033574" />');

        } else if (b.eq(1).hasClass('logo')) {

            boxImgs.eq(0).wrap('<a href="http://player.vimeo.com/video/34969501" />');
            boxImgs.eq(2).wrap('<a href="http://player.vimeo.com/video/35036115" />');
            boxImgs.eq(3).wrap('<a href="http://player.vimeo.com/video/35033574" />');

        } else if (b.eq(2).hasClass('logo')) {

            boxImgs.eq(0).wrap('<a href="http://player.vimeo.com/video/34969501" />');
            boxImgs.eq(1).wrap('<a href="http://player.vimeo.com/video/35036115" />');
            boxImgs.eq(3).wrap('<a href="http://player.vimeo.com/video/35033574" />');

        } else {

            boxImgs.eq(0).wrap('<a href="http://player.vimeo.com/video/34969501" />');
            boxImgs.eq(1).wrap('<a href="http://player.vimeo.com/video/35036115" />');
            boxImgs.eq(2).wrap('<a href="http://player.vimeo.com/video/35033574" />');

        }
  • 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-05-30T17:27:54+00:00Added an answer on May 30, 2026 at 5:27 pm

    You don’t have an array, you have a jQuery object (which is “array like”).

    If you need to keep your b object:

    var b = $('.box')
    

    …for other purposes then you can simply create another object that removes the “.logo” element(s):

    var bNoLogo = b.not(".logo");
    

    Though you don’t really need it if you just want to process the img elements in the non-logo box elements:

    var imgs = b.not(".logo").find("img");
    

    But it still ends up a bit clunky to assign individual anchors to the remaining elements:

    var urls = [
        'http://player.vimeo.com/video/34969501',
        'http://player.vimeo.com/video/35036115',
        'http://player.vimeo.com/video/35033574'
    ];
    
    b.not(".logo").find("img").each(function(i) {
        $(this).wrap( $("<a>").attr("href", urls[i]) );
    });
    

    Obviously (just as in your original code) this assumes that the number of elements without the “logo” class will exactly match the number of video urls (or at least be less than the number of video urls).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any built-in function in Python3/Numpy which filters an array and returns indices
Ruby has a select method that takes an array and returns a subarray consisting
In Scala, { x: Option[Int] => x } .getClass .getMethod(apply, classOf[Option[_]]) .getGenericParameterTypes returns Array(scala.Option<java.lang.Object>)
I have a method which returns an array of fixed type objects (let's say
I have a Perl subroutine which returns an array of vaules, and I'd like
PHP: I have made up a function that returns an array. I would like
I have an Array that returns a requested series of dates that I would
I've been messing around with simplexml_load_file() function which returns SimpleXMLElement and for learning purposes,
The array $carry_over returns a really long list of entries, too long for my
If my PHP returns a array with 6 elements how would I access each

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.