I can’t figure out what’s wrong, please help.
new Num is passed in, console logs show that it is finding the correct element for activeSlide
var activeSlide = $("#ep"+newNum);
for (var i=0; i< allSlides.length; i++){
var slidegrab = $("#ep"+i);
console.log(slidegrab == activeSlide)
if (slidegrab == activeSlide){
console.log("stop loop and stop shuffle");
return;
} else {
slidegrab.appendTo('#slideshow');
}
}
My console will display the correct names for both the slidegrab and activeSlide variables. The conditional will display false for each loop, never is true. What am I missing?
Thanks!!
They’re two different jQuery object. You need to compare the DOM elements.
Or maybe you want to keep track of the current slide by index and no by element. That’s more common.