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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:29:13+00:00 2026-05-28T08:29:13+00:00

I am using a script called swipeview to put multiple instances of a gallery

  • 0

I am using a script called swipeview to put multiple instances of a gallery on a page. It generates the structure like this:

<div id="slider-1">
    <div id="swipeview-slider">
        <div id="swipeview-masterpage">
            <img src="images/01.jpg" id="one"/>
        </div>
        <div id="swipeview-masterpage" class="swipeview-active">
            <img src="images/02.jpg" id="two"/>
        </div>
    </div>
</div>
<div id="slider-2">
    <div id="swipeview-slider">
        <div id="swipeview-masterpage">
            <img src="images/01.jpg" id="one"/>
        </div>
        <div id="swipeview-masterpage" class="swipeview-active">
            <img src="images/02.jpg" id="two"/>
        </div>
    </div>
</div>

The only thing that is unique to each image is the top-level div ID (slider-1, slider-2).

Without using jQuery, how can I get the ID of each separate image within the ‘swipeview-active’ class?

With jQuery I would select them with something along these lines:

$('#slider-1 > .swipeview-slider > .swipeview-masterpage .swipeview-active > img ').attr('id');

How can I do achieve this in regular js?

  • 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-28T08:29:14+00:00Added an answer on May 28, 2026 at 8:29 am

    First of all: IDs must not start with a digit.
    The dot-selector selects elements by class name. Use class=.. instead of id=....

    Corrected code, using document.querySelectorAll (demo: http://jsfiddle.net/rGAkm/3/).

    var images = document.querySelectorAll('#slider-1 > .swipeview-slider > .swipeview-masterpage .swipeview-active > img[id]');
    var len = images.length;
    var output = document.getElementById('output');
    for (var i=0; i<len; i++) {
        var image = images[i];
        output.appendChild(image);
    }
    

    Replace #slider-1 with [id^="slider-"] if you want to select all images in this structure, which is a child of id="slider-1", id="slider-2", …

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

Sidebar

Related Questions

I am using a jquery script called datatables, this adds a lot of functions
I'm trying to call to external PHP script using Ajax like this: $(function() {
Suppose I have a python script called my_parallel_script.py that involves using multiprocessing to parallelize
I am using pdb to examine a script having called run -d in an
I'm using the following script to request new content to a file called index.html:
I'm using this script to display all the images in a folder, but I
I'm using Firefox 3.6.6. I have a PHP script called index.php with the following
Trying to set up the svn commit with trac using this script. It is
When I try using include to add php code to a sendmail script called
I have found this popular PHP/MySQL Script called Zip Location by SaniSoft and it

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.