Hide and show various divs

Hide and show various divs

I've got the following code. How to create a certain click function which shows just the div according to the link I've clicked on, the others should be hidden. I've already tried to get the rel attr, saved it into a variable, that didnt work.

  1. var rel = $(this).attr(rel);
  2. $(rel).show();
  3. $(rel).next().hide();
  1. <a href="#" rel="one">One</a>
  2. <a href="#" rel="two">Two</a>
  3. <a href="#" rel="thress">Three</a>
  1. <div id="one></div>
  2. <div id="two">/div>
  3. <div id="thress</div>