Help with selector
Help with selector
Hi Jquery forum!
I have a problem regarding getting the right selector. I'm trying to make a webpage, who fades between diffrent divs, subpages and back to frontpage. So here is my code:
- $("span").click(function () {
var value = $(this).attr('id');
switch(value)
{
case 'test1':
var whoAmI = "#value1";
$("#value1").fadeIn("slow");
$("#fadeBack").hide();
break;
case 'test2':
var whoAmI = "#value2";
$("#value2").fadeIn("slow");
$("#fadeBack").hide();
break;
case 'back':
//var value = $("div").attr('id');
whoAmI = $(".fade").attr('id');
$("#fadeBack").fadeIn("slow");
$("#"+whoAmI).hide();
break;
}
$('body').append("Value: " + whoAmI);
});
But I can't find a way to get the right value on whoAmI?
Now I only get the first?
If you need more informations don't hesitate to say so :)