I'm having trouble getting parseInt() to work. I've got an <li> list with the ids set to numbers. And I'm trying to use .attr() to extract the value and then parseInt() to turn it into a number. But it's not working. Here is my code:
var thisIDtoN = $('.card:eq(' + i + ')').attr('id');
var thisToSort = parseInt(thisIDtoN);
It's giving me the correct number when I print to my console but it's printing as a string. Any ideas?
Nope, setInterval didn't work either. I can't see why when I change the swap line above to:
setTimeout(swap, 25, j, j+1);
It doesn't wait 25 ms before each swap instead of leaving me with the same unsorted page (as noted, it works as posted above). I may just turn it in for partial credit, 5 hours with no progress is enough.