Pixel2Life Forum: specifying variables with jquery - Programming and General Web Design - Pixel2Life Forum

Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

specifying variables with jquery

Array

#1 User is offline   derek.sullivan 

  • Jedi In Training
  • PipPip
  • Group: Members
  • posts 343
  • Joined: 26-November 06
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 21 March 2011 - 01:04 PM

What I am looking to do is the show() feature in jquery. In my PHP code, I have the code listing directories and each directory's link I want to have a specific link and a specific <div> tag under it. For instance:

[directory link]
[div tag]

The div tag's id will be the same as the directory name, so when I click the directory link "1" it will show the div "1" under the link. Does that make sense? Now, I know how to show/hide div's in jquery, but how do I call specific variables with it?
0

#2 User is offline   derek.sullivan 

  • Jedi In Training
  • PipPip
  • Group: Members
  • posts 343
  • Joined: 26-November 06
  • Gender:Male
  • Location:Georgia
  • Interests:preaching, programming, music, friends, outdoors, moves, books

Posted 21 March 2011 - 03:21 PM

The directory name would also be "1"
0

#3 User is offline   rc69 

  • PHP Master PD
  • PipPipPipPip
  • Group: P2L Staff
  • posts 3,827
  • Joined: 26-September 04
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 March 2011 - 06:35 PM

I don't know what you mean by variables, but this could easily be accomplished by selecting the next sibling of the link (if there is literally nothing else between the two).

i.e.
$('.directory').click(function (){
    $(this).next().show();
});

p.s. Showing the exact markup would help us give other suggestions :)
0

Share this topic:


  • You cannot start a new topic
  • You cannot reply to this topic

0 user(s) are reading this topic
members, guests, anonymous users