Ok so I have this function that when a contact is clicked it adds a class to the user
$(".contactlink").live("click",function(e){
if(lastclicked == $(this).attr('href'))
{
return false;
}
contactinfo = lastclicked.split('/');
alert(lastclicked);
lastclicked = $(this).attr('href');
contactinfo = $(this).attr('href').split("/");
$("#friend_"+contactinfo[2]).addClass('active');
loadcontactinfo(contactinfo[2]);
//alert( contactinfo[2] );
return false;
});
All is working fine, but this part of the function seems not to be saving it self to the jquery.
contactinfo = lastclicked.split('/');
alert(lastclicked);
cos when I do lastclicked it does not alert me what the href link which was click was last.
You should make sure that you are declaring variables with
varin the proper scope. Try something like:For a simplified example see this jsfiddle