0

I'm trying to build a simple Bingo site where a button choose a random number, and this number changes the color of a div, so it is visible that this number is picked.

I only want it to remember which numbers are chosen locally.

I think it is maybe something to do with localStorage(), but i can not figure out how.

Little piece of code where it selects a random number looks like this:

$('.new_number').click(function(){
    random_number = Math.floor((Math.random(1,90) * 90) + 1) ;
    $('.' + random_number).toggleClass('box1');
    localStorage
})
ℛɑƒæĿᴿᴹᴿ
  • 4,983
  • 4
  • 38
  • 58
  • 1
    Does this help? [How to use local-storage from JavaScript?](https://stackoverflow.com/a/56594935/14016161). – Julia Dec 31 '22 at 10:11
  • [How to store objects in HTML5 localStorage/sessionStorage](https://stackoverflow.com/questions/2010892/how-to-store-objects-in-html5-localstorage-sessionstorage) – ℛɑƒæĿᴿᴹᴿ Dec 31 '22 at 10:29
  • If you don't refresh the page after choosing a number you don't need to use local storage! – 54ka Dec 31 '22 at 10:31

0 Answers0