By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

Show/hide images

P: 3
Expand|Select|Wrap|Line Numbers
  1. function toggle(element, speed) {
  2.     if (document.getElementById(element).style.display == 'none') {
  3.         $(element). toggle(speed);
  4.     } else {
  5.         $(element). hide(speed);
  6.     }
  7. }
  8.  
this is suppose to show and hide pictures uploaded from mysql database according to image_id and album_id it works but all it does is toggle through the first image how can i get it to show and hide the rest of the images with the same album_id
Nov 16 '12 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
I wonder that worked at all. looking at the element calls, only either of that should work (when you pass an ID, then the getElementById() would work, but not $(element) and vice versa).

looking at the code it doesn’t seem to concern more than one element, unless you ignored the "IDs must be unique" rule.
Nov 16 '12 #2

Post your reply

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