Friday, 9 August 2013

Can a variable be produced from an if else statement?

Can a variable be produced from an if else statement?

hrefCan I change a variables value based on an if/else statement in
javascript?
var $nextLink = $this.next().attr('href'),
$currentLink = $this.attr('href');
if ($currentLink == $nextLink){ // Check if next link is same
as current link
var $nextLoad = $this.eq(2).attr('href'); // If so, get the next link
after the next
}
else {var $nextLoad = $nextLink;}

No comments:

Post a Comment