show current clicked div hide previous clicked div

Posted by user295927 on Stack Overflow See other posts from Stack Overflow or by user295927
Published on 2010-03-24T17:10:29Z Indexed on 2010/03/24 17:13 UTC
Read the original article Hit count: 188

Filed under:

Hi All, The code below is working, but with a problem I do not understand. When I click on first navigation link it is showing the div, this is what I want, but when I click on another nav link it does show the next div as expected but I need for the previous div(s) to hide. any help is appreciated.

something like: if this is not the nav link that was clicked hide. I would think.

$(document).ready(function(){

$('#navigation a').click(function (selected) {

var getName = $(this).attr("id");
var projectImages = $(this).attr("name");

//console.log(getName);
//console.log(projectImages);

$(function() {

 $("#" + projectImages ).show("normal");

});

});

});

© Stack Overflow or respective owner

Related posts about jQuery