what i am trying to do is when i click on the link, it will grab the title of the then use it as an ID selector to call an element with the ID of #target to show. I have set the title of the link to be as such about and it is supposed to target a . My guess is that the data type is not the same so I cannot use the title directly as a ID selector? Please help or is there any better solution for this to be done?
$("a").click(function(event){
event.preventDefault();
var target = $(this).attr("title");
alert(target);
$("article").fadeOut("slow", function(){
//animation completed
$(target).fadeIn("slow");
});
});
all you can do is
so you code will be
As per the jQuery documentation “#” is id selector, so whenever you are try to access element by its id you need ot appedn “#” i.e you code will become