how can i show a div having id dynamically generating by php

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
djdon11
Forum Commoner
Posts: 90
Joined: Wed Jun 20, 2007 5:03 pm

how can i show a div having id dynamically generating by php

Post by djdon11 »

hello Friends

i have an issue of javascript. actually i am hiding and showing a div with a javascript by using the id's of div
now the problem is that the divs are now gerating dynamically by a loop of php so now the id of the div are dynamic so how can i use this id to pass it to the javascript function to show and hide the div


please any body help me
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Re: how can i show a div having id dynamically generating by php

Post by potato »

repeating your loop that generated the dynamic div id's, but now with the javascript in the loop?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: how can i show a div having id dynamically generating by php

Post by Jonah Bron »

do it like this:

Code: Select all

document.getElementById('2, for example').style.display=none;
The javascript above uses css to hide the div.
Post Reply