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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:33:15+00:00 2026-06-13T03:33:15+00:00

I have a layout like this and I need to reach the AreaForMaps n

  • 0

I have a layout like this and I need to reach the AreaForMapsn nodes and hide them

This is my HTML:

<div id="layout1" class="layout1_wrapper">

    <div class="grid">
        <div class="block">
            <div id="AreaForMaps1" name="AreaForMaps1">
                <div id="googlemaps1">
                </div>
            </div>
        </div>
    </div>

    <div class="grid">
        <div class="block">
            <div id="AreaForMaps2" name="AreaForMaps2">
                <div id="googlemaps2">
                </div>
            </div>
        </div>
    </div>

    <div class="grid">
        <div class="block">
            <div id="AreaForMaps3" name="AreaForMaps3">
                <div id="googlemaps3">
                </div>
            </div>
        </div>
    </div>

</div>

JavaScript:

<script>
document.getElementById("Button").onclick = function(){  
//need to reach all AreaForMapsXXX divs and hide them  
var myDiv = document.getElementById( "layout1" );
var children = document.getElementById(layout1).childNodes;

  for(i=0; i<children.length; i+=3) { 
    document.getElementById(children[i].id).style.display = "none";
  }  
}
</script>
  • 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-13T03:33:16+00:00Added an answer on June 13, 2026 at 3:33 am

    There are several ways to go about it. Here’s one way.

    document.getElementById("Button").onclick = function(){  
        var myDiv = document.getElementById( "layout1" );
        var divs = myDiv.getElementsByTagName("div");
    
        for(i=0; i<divs.length; i++) { 
          if (divs[i].id.indexOf("AreaForMaps") === 0)
              divs[i].style.display = "none";
        }  
    }
    

    Your code was only targeting nodes that are immediate children of "layout1", and was including text nodes (the tab and newline characters are represented as nodes in the DOM).

    This code gets all div elements that descend from "layout1", and verifies that the first part of their ID starts with "AreaForMaps" before hiding it.


    If the list of browsers you support only include IE8 and higher, you can do this instead:

    document.getElementById("Button").onclick = function(){  
        var divs = document.querySelectorAll( "#layout1 div[id^=AreaForMaps]" );
    
        for(i=0; i<divs.length; i++)
            divs[i].style.display = "none";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML page layout - something like this: <div id='header'> Header content
I have a basic website nav layout that looks like this: <li class=folder parent_folder>
I have a layout like this in xml format. But I need to do
I have a layout like this in which I want to display a label
For Example, I have a layout like this: <ScrollView> <LinearLayout> <LinearLayout> ... </LinearLayout> <LinearLayout>
I have an item layout like this, and set the background by using item
I have a layout which looks like this: <LinearLayout> <ImageView> android:width=wrap_content android:height:wrap_content ... </ImageView>
I have the layout of a configuration dialog in an XML like this: <?xml
I have a layout with two children one after another, like this: |<view1><text1> |
I need to create a layout like this but with all the containers on

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.