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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:27:55+00:00 2026-06-16T22:27:55+00:00

I have searched all day and can´t find an answer to my problem. I

  • 0

I have searched all day and can´t find an answer to my problem.

I have the folowing DIV setup:

<div id="MainDiv1">
    <div id="Galery1">
        <div id="Image" style="width:100px;"></div>
        <div id="Image" style="width:100px;"></div>
        <div id="Image" style="width:100px;"></div>
    </div>
</div>
<div id="MainDiv2">
    <div id="Galery2">
        <div id="Image" style="width:80px;"></div>
        <div id="Image" style="width:80px;"></div>
        <div id="Image" style="width:80px;"></div>
    </div>
</div>

What I need is, with Javascript, to set a variable with the Width of any of the “Image” DIV, but only the ones in the “Galery1”.
Since they all have the same width any of them will work.

I have tryed:

DIVwidth = document.getElementById("Image");

But this always gives me back 80px, that are from the “Galery2” DIV.
I assume I have to give a Path somehow to limit the search into the “Galery1” or “MainDiv1” DIVs.

I can not give unique names to the DIVs.

Any suggestions?

  • 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-16T22:27:56+00:00Added an answer on June 16, 2026 at 10:27 pm

    IDs should be unique. I.E. you should not have more than one id="Image"

    To select the first div in Gallery2 try this:

    document.getElementById( 'Gallery2' ).getElementsByTagName( 'div' )[0]; // <-- '0' gets first item from array
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched Google all day and can't find the correct answer to my issue,
Good day, I have searched far and wide but all I can find is
I have read the documentation and searched all over but I can't find how
I have searched all morning and yesterday afternoon and still cannot find an solution
So I have searched all over the place and I can not seem to
I have been trying to figure this out all day. I've searched SO and
I have searched through the forum for my answer, But all the calendar questions
I have searched Google all day for an example to do the following type
This is an interesting problem that I have searched here and all over my
I have already searched all day for a solution. Unfortunately, have not found anything

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.