473,385 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How can I select several DIV-Objects using their ID

Hello.
Okay, here's my problem:
I got several DIV's and all start with the same ID="contentDiv" and at the end they got a number.
For example, the php could generate following DIVs:
contentDiv2
contentDiv4
contentDiv23
contentDiv24
I just want to set all of these DIVs to:
div.style.display = 'none';
but I have no idea how I could efficiently select them.
All my Ideas are way to complicated and cause a noticeable delay...
getElementsByName isn't possible because DIVs do not have the "name"-tag...
and I heard that getElementsByClass (/Name) doesn't work for IE...
Does anyone of you got a professional solution for this problem?

Thank you in advance.
Chris
Oct 13 '10 #1

✓ answered by Dormilich

give the divs a class and use a cross-browser implementation of getElementsByClassName() (ex.)

2 1042
Dormilich
8,658 Expert Mod 8TB
give the divs a class and use a cross-browser implementation of getElementsByClassName() (ex.)
Oct 13 '10 #2
Okay, this seems to be perfect for my needs.
Thank you very much.
Chris :)
Oct 13 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Philo | last post by:
How do I select all <div> tags except those which contain a <table> tag somewhere within them? Example XML: <********************** sample input ***********************> <txtSectionBody>...
8
by: Malc | last post by:
Can somebody please tell me whether the following syntax is supported or whether it's a "feature" that will someday stop working. It works in both SQL Server 2000 and 2005 at the moment. declare...
0
by: reidarT | last post by:
How do I get the rows from a databound listbox to a textfield I wan to click a button to get one row or several rows from my listbox to the textfield. reidarT
5
by: visu | last post by:
Hi this is a question asked in this group two years back.. No answer for this question till date. now i am in the same situation of the questioner.. to find a solution for this problem. Can any...
3
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a...
5
by: =?iso-8859-1?q?Jean-S=E9bastien?= | last post by:
Hello, Is it possible to have a div component, that i repeat several time on an html page : all those occurences of the div with the same dom id. thanx.
3
by: SJ | last post by:
Can you help me.... I want this layout --------------- --------------- ----------------- | text | | text | | text | | <select>| |<select| | <select |...
1
by: aswinm | last post by:
Hi All, I have a sample page in which I am enclosing a <Select within a DIV, The purpose is to have a horizontal scrollbar for the <Select. The page is working perfectly fine. But I notice that...
30
by: Jo at Isla | last post by:
I am away from UK travelling - hence no access to my VB software and previous build notes etc but have said that i will build a simple reservation system for the people with whom i am staying. I...
0
by: khushi patel | last post by:
I am working on Lightbox that has dropdown on it. depending on ddl value div should be shown up pleae help <%@ Page Title="" Language="VB" MasterPageFile="~/MasterSite.master"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.