I have a function that is fired when a user clicks on a link. When they click on another link, I want to alter the first link that they clicked on. How would I go about doing this? This is what I have so far:
$('a').click(function(){
//some code ...
if ( $(this).attr('id') != last.attr('id') ) {
$('a').click(function()
/*the original $this*/.parent().parent().quickFlipper({refresh: 0});
/*the original last*/.parent().parent().quickFlipper({refresh: 0});
});
var that = this;
var that2 = last;
setTimeout(function(){
$(that).parent().parent().quickFlipper({refresh :0});
$(that2).parent().parent().quickFlipper({refresh :0});
}, 1500);
//some more code ...
});
Thanks in advance and please ask any questions if you are unsure of what I am trying to accomplish.
This is a good time to use a closure.
Fiddle: http://jsfiddle.net/iambriansreed/Mus6N/