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
how can i show a div having id dynamically generating by php
Moderator: General Moderators
- 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
repeating your loop that generated the dynamic div id's, but now with the javascript in the loop?
- 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
do it like this:
The javascript above uses css to hide the div.
Code: Select all
document.getElementById('2, for example').style.display=none;