Hi eyerybody thankyou for the feedback
I'm new to wix (and to coding)
My family does a present exchange every year where we put all the names in a little basket and then each person pulls a name out and that's who they give their present to, except they can't be from their family.
So I made an array with all the names, and then they click on a button and a name comes up and then i ask them (and i trust them) if that person is from their family. if that person is, than they do it again, if they're not, then i delete that person from the array.
So it works fine except that when you reload the page the array goes back to what it was.
is there a way that the array is permanently affected? is there an alternative?
thanks again
here's my code (i speak spanish: familia=family; si=yes; no=no; the names are names; textcris is the textbox where the name appears)
var familia = ["¡BABY!","¡RICK!","¡CARLOS!","¡MIRNA!","¡NORI!","¡ARTURO IPIENS!","¡MIGUE!","¡BEATRIZ!","¡TOTOY!","¡ANY!","¡GUILLERMO!","¡MARIA JULIA!","¡ALEJO!","¡PEPE!","¡BRIGIT!","¡HANNAH!","¡DIEGO!","¡GABY!","¡CARLANGAS!","¡MAGGIE!","¡CARLITITOS!","¡JOSE LUIS!","¡NANCY!","¡REGINA!","¡ALE!","¡PABLO!","¡JULIETA!"] var rand = Math.floor(Math.random()*familia.length); $w.onReady(function () { } export function button1_click(event) { $w('#textcris').text = familia[rand]; $w('#asignar').hide(); $w('#si').show(); $w('#no').show(); $w('#text1').show(); $w('#textcris').show(); } export function no_click(event) { familia.splice(rand, 1); $w('#si').hide(); $w('#no').hide(); $w('#text1').hide(); //$w('#textcris').hide(); $w('#ok').show(); } export function si_click(event) { //Add your code for this event here: rand = Math.floor(Math.random()*familia.length); $w('#asignar').show(); $w('#textcris').hide(); $w('#si').hide(); $w('#no').hide(); $w('#text1').hide(); }
You can save the last random value setting using storage.setItem(). Then in the onReady() function, retrieve the value using storage.getItem(), and set the array using the value you just retrieved.
PLEASE HELP PROJECT DUE TOMORROW
Redirections on similar questions are also welcome