Forum: Ruby on Rails Element.toggle with multiple divs

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
patrick (Guest)
on 2005-11-13 16:56
(Received via mailing list)
i have a number of div's on my site with "id_distributor_1" to
"id_distributor_x" (x depends on the number of entries in the database).
now i´d like to toggle these divs. with using element.toggle i have to
the id-names, which is not the case because i don´t know how many
there are.

any suggestions?
Nshbrown N. (Guest)
on 2005-11-13 16:56
(Received via mailing list)
Untested, but you could do something like this...

function toggleDisplay()
    for (var x = 0; ; x++) {
      	if (var element = document.getElementById('id_distributor_' + x))
{ = 'none';
		} else {

Warmest regards,
This topic is locked and can not be replied to.