I do a click on the random block function:

function randomChange() { var numItems = $('.tablebox').length; var randomBlock = getRandomArbitary(2, numItems - 2); $(".tablebox:eq(" + randomBlock + ")").click(); } 

It is necessary to hide the previous item when clicking on a new one. How can I memorize the index of the previous item?

  • It would be better if you provide a minimum working example where you can see what is hidden and what is not! - Ihor Tkachuk
  • @IgorTkachuk, nothing is hidden, just trying to figure out how to get the previous number of random at randomness - Sdafs Fasafs

1 answer 1

figured out

 var lastindex = Number; //Глобальная переменная индекса function randomChange(index) { lastindex = randomBlock; $(".tablebox:eq(" + index + ")").hide(); } 

and the function itself

 randomChange(lastindex);