View Full Version : setting display property for div in array
rocg23
06-02-2008, 08:36 PM
I am trying to set up page so that one field is not displayed with the page loads. i am pulling the content from a database, so it is in an array. How can I identify the DIV's so that I can manipulate them.
I can do this with straight HTML and JavaScript, but can't figure it out with the array. because the content is dynamic between pages, I can't specify a head of time how many DIVs there will be in the CSS for each page.
I hope this makes sense...Thanks
Medyman
06-02-2008, 11:25 PM
Well, if everything is dynamic, then it can't be done. There has to be some constant -- the same class, the same id.
So, what's constant between the pages? What, exactly, are you trying to hide? Does what you're trying to hide change from page to page?
rocg23
06-04-2008, 03:31 PM
essentially I have a shopping cart, and I want to display the names of the items and the prices in a list form, then have a button to click to see the description. so the descriptions would be display: none; but of course, if I set them all with the same ID then they all pop up when I click to display....I have seen it work on other sites, but I may actually be going about it the wrong way.
Medyman
06-04-2008, 04:25 PM
Ok, do this:
Apply the same class to all of your description divs (it sounds like you have more than one).
Then use the javascript I helped another poster with here (http://dynamicdrive.com/forums/showthread.php?t=33138&p=146356).
You have to use JavaScript to manipulate the CSS styles.
rocg23
06-10-2008, 07:31 PM
Great, thanks....
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.