Selecting a div with same ID as the rel attribute of clicked link

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-24T03:44:07Z Indexed on 2010/03/24 3:53 UTC
Read the original article Hit count: 256

Filed under:
|
|

Hi there,

This is a two-part question. I'm using jQuery for a project and wanting to click a link and toggle the class name "highlight" to that link and also to the div with the same id as the rel attribute of the link. I then want to be able to link to the next div without the classname of "highlight". Here's the HTML for it:

<ul>
   <li><a href="#" rel="panel1">Item 1</a></li>
   <li><a href="#" rel="panel2">Item 2</a></li>
   <li><a href="#" rel="panel3">Item 3</a></li>
</ul>  

<a href="">go to next div without class of highlight</a>


<div id="panel1">some text</div>
<div id="panel2">some text</div>
<div id="panel3">some text</div>

Can anyone help with jQuery side of things?

Many thanks in advance!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css